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 00006 namespace MongoServices 00007 { 00008 internal sealed class ServiceConfigContainer<TService, TModel> 00009 where TService : MongoServicesService<TModel> 00010 where TModel : MongoServicesModel 00011 { 00012 #region Nested Singleton 00013 class Nested 00014 { 00015 // Explicit static constructor to tell C# compiler 00016 // not to mark type as beforefieldinit 00017 static Nested() 00018 { 00019 } 00020 00021 internal static readonly ServiceConfigContainer<TService, TModel> instance = new ServiceConfigContainer<TService, TModel>(); 00022 } 00023 00024 public static ServiceConfigContainer<TService, TModel> Instance 00025 { 00026 get 00027 { 00028 return Nested.instance; 00029 } 00030 } 00031 #endregion 00032 00033 #region BeforeSaveProcesses 00034 private List<Func<TModel, bool>> _beforeSaveProcesses = new List<Func<TModel, bool>>(); 00035 public List<Func<TModel, bool>> BeforeSaveProcesses 00036 { 00037 get { return _beforeSaveProcesses; } 00038 } 00039 #endregion 00040 00041 #region AfterSaveProcesses 00042 private List<Action<TModel>> _afterSaveProcesses = new List<Action<TModel>>(); 00043 public List<Action<TModel>> AfterSaveProcesses 00044 { 00045 get { return _afterSaveProcesses; } 00046 } 00047 #endregion 00048 } 00049 }