public static AggregateTableMapping GetAggregateMapping(Type type)
        {
            Assembly callingAssembly = DataContext.CallingAssembly;
            Dictionary <Type, AggregateTableMapping> mappings = null;

            if (callingAssembly == null)
            {
                mappings = _defaultMapping;
            }
            else
            {
                if (!_assemblyMapping.ContainsKey(callingAssembly))
                {
                    lock (_synobj) {
                        if (!_assemblyMapping.ContainsKey(callingAssembly))
                        {
                            _assemblyMapping.Add(callingAssembly, new Dictionary <Type, AggregateTableMapping> ());
                        }
                    }
                }
                mappings = _assemblyMapping [callingAssembly];
            }

            if (!mappings.ContainsKey(type))
            {
                lock (_synobj) {
                    if (!mappings.ContainsKey(type))
                    {
                        AggregateTableMapping mapping = CreateMapping(type);
                        mappings [type] = mapping;
                    }
                }
            }
            return(mappings [type]);
        }
        private static AggregateTableMapping CreateMapping(Type type)
        {
            Type   relateType  = null;
            string extendParam = null;
            AggregateTableMapping aggregateMapping = null;
            IAggregateTableConfig config           = ConfigManager.LoadAggregateTableConfig(type);

            if (config != null)
            {
                relateType  = config.RelateType;
                extendParam = config.ExtendParams;
            }
            aggregateMapping = new AggregateTableMapping(type, relateType);
            aggregateMapping.ExtentParams = new ExtendParamsCollection(extendParam);
            return(aggregateMapping);
        }