MongoServices 0.2.0
A Service/Repository Framework for mongoDB
|
00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 using MongoDB.Bson; 00006 00007 namespace MongoServices 00008 { 00013 public abstract class ReadOnlyService<T> : MongoServicesService<T>, IReadOnlyService<T> 00014 where T : MongoServicesModel 00015 { 00016 #region Protected Properties 00017 00018 00019 00020 protected IReadOnlyRepository<T> ReadOnlyRepository { get; private set; } 00021 #endregion 00022 00023 #region Public Constructors 00024 00025 00026 00027 00028 public ReadOnlyService(IReadOnlyRepository<T> readOnlyRepository) 00029 : base(readOnlyRepository) 00030 { 00031 ReadOnlyRepository = readOnlyRepository; 00032 } 00033 #endregion 00034 00035 #region Public Methods 00036 00037 00038 00039 00040 public IEnumerable<T> GetAll() 00041 { 00042 return ReadOnlyRepository.GetAll(); 00043 } 00044 00050 public T GetById(ObjectId id) 00051 { 00052 return ReadOnlyRepository.GetById(id); 00053 } 00054 #endregion 00055 } 00056 }