Ejemplo n.º 1
0
 public void SetPersistenceCreateMethod <T>(Action <T> saveMethod)
 {
     if (CreateMethods.ContainsKey(typeof(T)))
     {
         CreateMethods[typeof(T)] = saveMethod;
     }
     else
     {
         CreateMethods.Add(typeof(T), saveMethod);
     }
 }
Ejemplo n.º 2
0
        public void Create <T>(IList <T> list)
        {
            if (!CreateMethods.ContainsKey(typeof(IList <T>)))
            {
                throw new PersistenceMethodNotFoundException("No persistence create method set up for " + typeof(IList <T>).Name + ". Add one using BuilderSetup.SetPersistenceCreateMethod()");
            }

            var creator = CreateMethods[typeof(IList <T>)];

            creator.DynamicInvoke(list);
        }