Inheritance: IConfigurationSectionHandler
コード例 #1
0
ファイル: MongoMetadata.cs プロジェクト: scbond/MongOData
        public MongoMetadata(string connectionString, MongoConfiguration.Metadata metadata = null)
        {
            this.connectionString = connectionString;
            this.Configuration = metadata ?? MongoConfiguration.Metadata.Default;
            lock (MetadataCache)
            {
                MongoMetadataCache metadataCache;
                MetadataCache.TryGetValue(this.connectionString, out metadataCache);
                if (metadataCache == null)
                {
                    metadataCache = new MongoMetadataCache
                                        {
                                            DspMetadata = new DSPMetadata(ContainerName, RootNamespace),
                                            ProviderTypes = new Dictionary<string, Type>()
                                        };
                    MetadataCache.Add(this.connectionString, metadataCache);
                }
                this.dspMetadata = metadataCache.DspMetadata;
                this.providerTypes = metadataCache.ProviderTypes;
            }

            using (var context = new MongoContext(connectionString))
            {
                PopulateMetadata(context);
            }
        }
コード例 #2
0
        public MongoMetadata(string connectionString, MongoConfiguration.Metadata metadata = null)
        {
            _connectionString = connectionString;
            this.Configuration = metadata ?? MongoConfiguration.Metadata.Default;

            lock (s_metadataCache)
            {
                _instanceMetadataCache = GetOrCreateMetadataCache();
            }

            var context = new MongoContext(connectionString);
            PopulateMetadata(context);
        }
コード例 #3
0
        /// <summary>Constructor</summary>
        public MongoDataServiceBase(string connectionString, MongoConfiguration mongoConfiguration)
        {
            this.connectionString     = connectionString;
            this.mongoConfiguration   = mongoConfiguration;
            this.createUpdateProvider = () => new MongoDSPUpdateProvider(this.connectionString, this.CurrentDataSource, this.mongoMetadata);

            ResetDataContext = x =>
            {
                this.mongoMetadata = new MongoMetadata(x, this.mongoConfiguration == null ? null : this.mongoConfiguration.MetadataBuildStrategy);
                MongoDataServiceBase <T, Q> .context = this.CreateContext(x);
            };

            ResetDataContext(connectionString);
        }
コード例 #4
0
 public object Create(object parent, object configContext, XmlNode section)
 {
     var configuration = new MongoConfiguration();
     if (section != null)
     {
         int iResult;
         bool bResult;
         if (TryReadConfigurationValue(section, "metadataBuildStrategy/prefetchRows", out iResult))
             configuration.MetadataBuildStrategy.PrefetchRows = iResult;
         if (TryReadConfigurationValue(section, "metadataBuildStrategy/updateDynamically", out bResult))
             configuration.MetadataBuildStrategy.UpdateDynamically = bResult;
         if (TryReadConfigurationValue(section, "metadataBuildStrategy/persistSchema", out bResult))
             configuration.MetadataBuildStrategy.PersistSchema = bResult;
     }
     return configuration;
 }