コード例 #1
0
 public static IQueryable <TModel> Query <TModel>(
     this StandardDataSource <TModel, TestDbContext> source, Func <StandardDataSource <TModel, TestDbContext>, IQueryable <TModel> > method
     )
     where TModel : class, new()
 {
     return(method(source));
 }
コード例 #2
0
 public static StandardDataSource <TModel, TestDbContext> AddModel <TModel, TProp>(
     this StandardDataSource <TModel, TestDbContext> source, Expression <Func <TModel, TProp> > propSelector, TProp propValue
     )
     where TModel : class, new()
 {
     return(source.AddModel(propSelector, propValue, out _));
 }
コード例 #3
0
 public static StandardDataSource <TModel, TestDbContext> AddModel <TModel>(
     this StandardDataSource <TModel, TestDbContext> source, TModel model
     )
     where TModel : class, new()
 {
     source.Db.Set <TModel>().Add(model);
     source.Db.SaveChanges();
     return(source);
 }
コード例 #4
0
        public static StandardDataSource <TModel, TestDbContext> AddModel <TModel, TProp>(
            this StandardDataSource <TModel, TestDbContext> source, Expression <Func <TModel, TProp> > propSelector, TProp propValue, out PropertyViewModel propInfo
            )
            where TModel : class, new()
        {
            var model = new TModel();

            propInfo = source.ClassViewModel.PropertyBySelector(propSelector);
            propInfo.PropertyInfo.SetValue(model, propValue);
            return(source.AddModel(model));
        }
コード例 #5
0
 public static IQueryable <TModel> Query <TModel>(this StandardDataSource <TModel, TestDbContext> source)
     where TModel : class, new()
 {
     return(source.Db.Set <TModel>());
 }
コード例 #6
0
 public StandardDataSourceTests() : base()
 {
     CaseSource = Source <Case>();
 }