private Record CreateRecord(XElement element) { string id = null; Collection <IPropertyOperation> operations = null; foreach (XAttribute attribute in element.Attributes()) { if (DefaultComparer.NameEquals(attribute, AttributeNames.Id)) { id = GetValue(attribute); } else { IPropertyOperation operation = CreateOperationFromAttribute(element, attribute); (operations ?? (operations = new Collection <IPropertyOperation>())).Add(operation); } } Record record = CreateRecord(id); operations?.ExecuteAll(record); ExecuteChildOperations(element, record); ExecutePendingOperations(record); foreach (PropertyDefinition property in Entity.AllProperties()) { if (property.DefaultValue != null) { if (!record.ContainsProperty(property.Name)) { if (property.IsCollection) { record[property.Name] = new List <object>() { property.DefaultValue }; } else { record[property.Name] = property.DefaultValue; } } } else if (ShouldCheckRequiredProperty && property.IsRequired && !record.ContainsProperty(property.Name)) { Throw(ErrorMessages.PropertyIsRequired(property.Name)); } } return(record); }
public static Func <object, Expression <Func <T, bool> > > GetPredicateBuilder <T>(this IPropertyOperation builder, Expression <Func <T, object> > path) { MemberExpression memberExpression = path.GetMemberExpression(true); return(builder.GetPredicateBuilder <T>(memberExpression)); }
public static Expression <Func <T, bool> > GetPredicate <T>(this IPropertyOperation operation, Expression <Func <T, object> > path, object value) { return(operation.GetPredicateBuilder(path)(value)); }