Beispiel #1
0
        public DataParcelAttribute(
            string schemaName,
            string areaName,

            bool supportsMerge  = false,
            Type shardingParcel = null,
            ParcelPayloadWrappingMode wrappingMode = ParcelPayloadWrappingMode.NotWrapped,
            string replicationChannel = null,
            string cacheTableName     = null,
            int cacheWriteMaxAgeSec   = -1,
            int cacheReadMaxAgeSec    = -1,
            int cachePriority         = -1)
        {
            if (schemaName.IsNullOrWhiteSpace() ||
                areaName.IsNullOrWhiteSpace())
            {
                throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(schemaName|areaName=null|empty)");
            }

            SchemaName = schemaName;
            AreaName   = areaName;

            if (shardingParcel != null)
            {
                if (!typeof(Parcel).IsAssignableFrom(shardingParcel))
                {
                    throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(shardingParcel='" + shardingParcel.FullName + "' isnot Parcel-derived)");
                }
            }

            SupportsMerge       = supportsMerge;
            ShardingParcel      = shardingParcel;
            PayloadWrappingMode = wrappingMode;
            ReplicationChannel  = replicationChannel;
            CacheTableName      = cacheTableName;
            CacheWriteMaxAgeSec = cacheWriteMaxAgeSec < 0 ? (int?)null : cacheWriteMaxAgeSec;
            CacheReadMaxAgeSec  = cacheReadMaxAgeSec < 0 ? (int?)null : cacheReadMaxAgeSec;
            CachePriority       = cachePriority < 0 ? (int?)null : cachePriority;
        }
Beispiel #2
0
        public DataParcelAttribute(
                             string schemaName,
                             string areaName,
                             
                             bool supportsMerge = false,
                             Type shardingParcel = null,
                             ParcelPayloadWrappingMode wrappingMode = ParcelPayloadWrappingMode.NotWrapped,
                             string replicationChannel = null,
                             string cacheTableName = null,
                             int cacheWriteMaxAgeSec = -1,
                             int cacheReadMaxAgeSec = -1,
                             int cachePriority = -1)
        {
            if (schemaName.IsNullOrWhiteSpace() || 
                areaName.IsNullOrWhiteSpace())
             throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(schemaName|areaName=null|empty)");    

            SchemaName = schemaName;
            AreaName = areaName;
            
            if (shardingParcel!=null)
             if (!typeof(Parcel).IsAssignableFrom(shardingParcel))
              throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(shardingParcel='"+shardingParcel.FullName+"' isnot Parcel-derived)");
            
            SupportsMerge = supportsMerge;
            ShardingParcel = shardingParcel;
            PayloadWrappingMode = wrappingMode;
            ReplicationChannel = replicationChannel;
            CacheTableName = cacheTableName;
            CacheWriteMaxAgeSec = cacheWriteMaxAgeSec <0 ? (int?)null : cacheWriteMaxAgeSec;
            CacheReadMaxAgeSec  = cacheReadMaxAgeSec  <0 ? (int?)null : cacheReadMaxAgeSec;
            CachePriority       = cachePriority       <0 ? (int?)null : cachePriority;    
        }