Пример #1
0
 public static bool Validate (BaseRestPostModel model, WebDbContext db , out Xiake  account,params string[] includies)
 {
     IQueryable<Xiake > query = includies.Aggregate<string, IQueryable<Xiake >>(db.Xiakes , (current, include) => current.Include(include));
     var acc = query.FirstOrDefault(a => a.Id  == model.XiakeID); 
     account = acc;
     if(acc == null)
         throw new JsonException(Resources.ErrorReLogin);
     if(! XCodeHelper.ValidateXCode(model, acc.Token))
         throw new JsonException(Resources.ErrorReLogin);
     return true;
 }
Пример #2
0
		public static WebDbContext CreateDbContext()
		{ 
            
            //var context = CallContext.GetData("DbContext") as WebDbContext;
            //if(context == null)
            //{
		    var    context = new WebDbContext();
		        context.Database.CreateIfNotExists();
		        context.Configuration.LazyLoadingEnabled = false;
                CallContext.SetData("DbContext", context);
		   // }
             
			return context;
		}
Пример #3
0
 public static bool Validate(BaseRestPostModel model, WebDbContext db)
 {
     Xiake  acc = null;
     
     return Validate(model, db, out acc);
 }