Inheritance: DbContext
    public static ValidationResult FooIDUnique(Foo foo, ValidationContext context)
    {
        bool check = false;

        using (FooEntities fe = new FooEntities())
        {
            check = fe.Foo.Any(f => f.FooId == foo.fooId);
        }
        if (!check)
        {
            return(ValidationResult.Success);
        }

        return(new ValidationResult("FooID error msg,", new string[] { "FooID" }));
    }
Exemple #2
0
 public TagService(FooEntities entity)
 {
     _entity = entity;
 }
 public MyAppController()
 {
     Db = new FooEntities();
 }
Exemple #4
0
 public ExpenseService(FooEntities entity)
 {
     _entity = entity;
 }