Esempio n. 1
0
 public void AttachAggregatePropertyToEntity(TEntity entity)
 {
     foreach (var item in _allProperties)
     {
         entity.InitializeCalculatedProperty(RuleAwareEntityPropertyInfo.GetCalculatedProperty(_entityType, item)
                                             , _aggregateProperties[item]);
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }