public void AttachAggregatePropertyToEntity(TEntity entity) { foreach (var item in _allProperties) { entity.InitializeCalculatedProperty(RuleAwareEntityPropertyInfo.GetCalculatedProperty(_entityType, item) , _aggregateProperties[item]); } }
public Grouping(RuleEngineContext.RuleEngineContext context, IEnumerable <TEntity> entity, IEnumerable <AggregatePropertyMetadata <TEntity> > aggregateProps) { _aggregateProperties = new PropertyBag(BagType.Calculated, context.RootEntityType); _entityType = context.RootEntityType; Entity = entity; this._aggregateProps = aggregateProps; foreach (var item in aggregateProps) { var prop = RuleAwareEntityPropertyInfo.GetCalculatedProperty(_entityType, item.PropertyName); _aggregateProperties.Initialize(prop); _allProperties.Add(item.PropertyName); } CalculateAggregatePropertiesForGroup(entity); }
public Property SearchProperty(string property) { if (BagType == BagType.Dynamic) { if (ContainsProperty(property)) { return(RuleAwareEntityPropertyInfo.GetDynamicProperty(_entityType, property)); } } if (BagType == BagType.Calculated) { if (ContainsProperty(property)) { return(RuleAwareEntityPropertyInfo.GetCalculatedProperty(_entityType, property)); } } throw new PropertyNotFoundException(property, _entityType); }
public bool ContainsProperty(string property) { if (BagType == BagType.Dynamic) { var prop = RuleAwareEntityPropertyInfo.GetDynamicProperty(_entityType, property); if (prop.IsNotFound) { return(false); } return(true); } if (BagType == BagType.Calculated) { var prop = RuleAwareEntityPropertyInfo.GetCalculatedProperty(_entityType, property); if (prop.IsNotFound) { return(false); } return(true); } return(false); }