public MixInValidation(DynamicModel mixWith) { rules = new List <dynamic>(); errors = new List <dynamic>(); @this = mixWith; if (HasValidationCapabilities(mixWith)) { mixWith.SetUnTrackedMember("Errors", new DynamicFunction(Errors)); mixWith.SetUnTrackedMember("IsValid", new DynamicFunctionWithParam(IsValid)); mixWith.SetUnTrackedMember("FirstError", new DynamicFunction(FirstError)); IEnumerable <dynamic> validationRules = @this.Validates(); foreach (var validationRule in validationRules) { validationRule.Init(mixWith); AddRule(validationRule); } } }
private void AddAssociationMethod(DynamicModel model) { model.SetUnTrackedMember( Named, Query(model)); model.SetUnTrackedMember( Singular(Named) + "Ids", QueryIds(model)); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey; model.SetUnTrackedMember( Singular(Repository), Query(foreignKeyName, Repository.GetType().Name, through.GetType().Name, ForeignKeyFor(Repository), model)); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey; model.SetUnTrackedMember( Singular(Repository), new DynamicFunction(() => Repository.SingleWhere(foreignKeyName + " = @0", model.GetMember(Id())))); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(Repository) : ForeignKey; string primaryKeyName = string.IsNullOrEmpty(PrimaryKey) ? "Id" : PrimaryKey; string whereClause = string.Format("{0} = @0", primaryKeyName); model.SetUnTrackedMember( Named, new DynamicFunction(() => Repository.SingleWhere(whereClause, model.GetMember(foreignKeyName)))); }
public MixInAssociation(DynamicModel mixWith) { if (!SupportsAssociations(mixWith)) { return; } IEnumerable <dynamic> associations = (mixWith as dynamic).Associates(); foreach (dynamic association in associations) { referencedAssociations.Add(association); association.Init(mixWith); } mixWith.SetUnTrackedMember("AssociationNamed", new DynamicFunctionWithParam(AssociationNamed)); }
public MixInValidation(DynamicModel mixWith) { rules = new List<dynamic>(); errors = new List<dynamic>(); @this = mixWith; if (HasValidationCapabilities(mixWith)) { mixWith.SetUnTrackedMember("Errors", new DynamicFunction(Errors)); mixWith.SetUnTrackedMember("IsValid", new DynamicFunction(IsValid)); mixWith.SetUnTrackedMember("IsPropertyValid", new DynamicFunctionWithParam(IsValid)); mixWith.SetUnTrackedMember("FirstError", new DynamicFunction(FirstError)); IEnumerable<dynamic> validationRules = @this.Validates(); foreach (var validationRule in validationRules) { validationRule.Init(mixWith); AddRule(validationRule); } } }
private void AddAssociationMethod(DynamicModel model, string fromColumn, string toTable) { model.SetUnTrackedMember( named, Query(fromColumn, toTable, through.GetType().Name, Using ?? ForeignKeyFor(repository), model)); model.SetUnTrackedMember( Singular(named) + "Ids", QueryIds(fromColumn, toTable, through.GetType().Name, Using ?? ForeignKeyFor(repository), model)); }
private void AddAssociationMethods(DynamicModel model, string fromColumn, string toTable) { model.SetUnTrackedMember(named, Query(fromColumn, model)); model.SetUnTrackedMember(Singular(named) + "Ids", QueryIds(fromColumn, model)); }
private void AddAssociationMethods(DynamicModel model, string fromColumn, string toTable) { model.SetUnTrackedMember(Named, Query(fromColumn, model)); model.SetUnTrackedMember(Singular(Named) + "Ids", QueryIds(fromColumn, model)); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(Repository) : ForeignKey; string primaryKeyName = string.IsNullOrEmpty(PrimaryKey) ? "Id" : PrimaryKey; string whereClause = string.Format("{0} = @0", primaryKeyName); model.SetUnTrackedMember( Named, new DynamicFunction(() => Repository.SingleWhere(whereClause, model.GetMember(foreignKeyName)))); }
public MixInAssociation(DynamicModel mixWith) { if (!SupportsAssociations(mixWith)) return; IEnumerable<dynamic> associations = (mixWith as dynamic).Associates(); foreach (dynamic association in associations) { referencedAssociations.Add(association); association.Init(mixWith); } mixWith.SetUnTrackedMember("AssociationNamed", new DynamicFunctionWithParam(AssociationNamed)); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey; model.SetUnTrackedMember( Singular(Repository), Query(foreignKeyName, Repository.GetType().Name, through.GetType().Name, ForeignKeyFor(Repository), model)); }
public void Init(DynamicModel model) { string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey; model.SetUnTrackedMember( Singular(Repository), new DynamicFunction(() => Repository.SingleWhere(foreignKeyName + " = @0", model.GetMember(Id())))); }
private void AddAssociationMethod(DynamicModel model) { model.SetUnTrackedMember( Named, Query(model)); model.SetUnTrackedMember( Singular(Named) + "Ids", QueryIds(model)); }