private dynamic EntityFor(DynamicModel model, dynamic attributes) { var entity = new Gemini(attributes); entity.SetMember(ForeignKeyFor(model), model.GetMember(Id())); return(Repository.Projection(entity)); }
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 bool Validate(DynamicModel entity) { dynamic value = entity.GetMember(Property); if (value == null && IgnoreNull == true) { return(true); } if (value == null) { return(false); } int length = value.Length; if (Minimum != null && length < Minimum) { return(false); } if (Maximum != null && length > Maximum) { return(false); } if (In != null && !In.Contains(length)) { return(false); } if (Is != null && length != Is) { return(false); } return(true); }
public bool Validate(DynamicModel entity) { dynamic value = entity.GetMember(Property); if (value == null && IgnoreNull == true) return true; if (value == null) return false; int length = value.Length; if (Minimum != null && length < Minimum) return false; if (Maximum != null && length > Maximum) return false; if (In != null && !In.Contains(length)) return false; if (Is != null && length != Is) return false; return true; }
private dynamic EntityFor(DynamicModel model, dynamic attributes) { var entity = new Gemini(attributes); entity.SetMember(ForeignKeyFor(model), model.GetMember(Id())); return repository.Projection(entity); }
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())))); }