public PrefetchPolicyBuilder WithRule(IPropertyType propertyType, PrefetchPolicy prefetch)
        {
            var rule = new PrefetchRule(propertyType, prefetch);

            this.rules.Add(rule);
            return(this);
        }
Exemple #2
0
        static PrefetchPolicyBuilderExtensions()
        {
            AccessControlPrefetchPolicy = new PrefetchPolicyBuilder()
                                          .WithRule(MetaAccessControl.Instance.CacheId.RoleType)
                                          .Build();

            SecurityTokenPrefetchPolicy = new PrefetchPolicyBuilder()
                                          .WithRule(MetaSecurityToken.Instance.AccessControls, AccessControlPrefetchPolicy)
                                          .Build();
        }
        public PrefetchRule(IPropertyType propertyType, PrefetchPolicy prefetchPolicy)
        {
            if (propertyType == null)
            {
                throw new ArgumentNullException("propertyType");
            }

            if (prefetchPolicy != null)
            {
                if (propertyType is IRoleType roleType && roleType.ObjectType.IsUnit)
                {
                    throw new ArgumentException("prefetchPolicy");
                }
            }

            this.PropertyType   = propertyType;
            this.PrefetchPolicy = prefetchPolicy;
        }
Exemple #4
0
 static PrefetchPolicyBuilderExtensions()
 {
     SecuritTokenPrefetchPolicy = new PrefetchPolicyBuilder()
                                  .WithRule(MetaSecurityToken.Instance.AccessControls)
                                  .Build();
 }