public static void Execute() { CovFactory <Animal> ani = new CovFactory <Dog>((name, legs) => { Dog dog = new Dog() { Name = name, NumberOfLegs = legs }; return(dog); }); CovFactory <Animal, Animal> ant = (out Animal T1, string name, int legs) => { T1 = new Dog(); return(T1); }; ani.Invoke("Puppy", 4).Display(); Console.WriteLine("**********************"); ConFactory <Dog> dog = new ConFactory <Animal>(param => { param.Display(); }); dog.Invoke(new Dog() { Name = "Tommy", NumberOfLegs = 4 }); }
public static long Insert <T>(this T entity) where T : IDbTable { using (var db = ConFactory.GetConnection()) { db.Open(); return(db.Insert(entity)); } }
public static T Get <T>(int id) { using (var db = ConFactory.GetConnection()) { db.Open(); return(db.Get <T>(id)); } }
public static void Update <T>(this T entity) where T : IDbTable { using (var db = ConFactory.GetConnection()) { db.Open(); SqlMapperExtensions.Update(db, entity); } }
public static void Delete <T>(this T entity) where T : IDbTable { using (var db = ConFactory.GetConnection()) { db.Open(); db.Delete(entity); } }