Esempio n. 1
0
 public CachedSchema(CachedSchema cached)
 {
     DbSchema        = new XElement(cached.DbSchema);
     RevisedDbSchema = new XElement(cached.RevisedDbSchema);
     MappedSchema    = new XElement(cached.MappedSchema);
     RevisedSchema   = new XElement(cached.RevisedSchema);
 }
Esempio n. 2
0
        private CachedSchema NewCachedSchema(string name, SchemaSource source)
        {
            XElement config = InstanceConfigGetter.GetConfig(name);

            CachedSchema cachedSchema;

            if (source == SchemaSource.DbSchemaProvider)
            {
                cachedSchema = new CachedSchema()
                {
                    DbSchema = GetDbSchemaProvider(name, config).GetDbSchema()
                };
            }
            else
            {
                cachedSchema = new CachedSchema(Cache[name]);
            }
            if (source <= SchemaSource.DbSchemaReviser)
            {
                cachedSchema.RevisedDbSchema = GetDbSchemaReviser(config).Revise(cachedSchema.DbSchema);
            }
            if (source <= SchemaSource.Mapper)
            {
                cachedSchema.MappedSchema = GetMapper(config).Map(cachedSchema.RevisedDbSchema);
            }
            if (source <= SchemaSource.SchemaReviser)
            {
                XElement revisedSchema = GetSchemaReviser(config).Revise(cachedSchema.MappedSchema);
                DateTime utcNow        = DateTime.UtcNow;
                cachedSchema.RevisedSchema = revisedSchema;
            }

            return(cachedSchema);
        }
Esempio n. 3
0
        public void Update(string name, SchemaSource source)
        {
            CachedSchema cachedSchema = NewCachedSchema(name, source);

            lock (LockObj)
            {
                Cache[name] = cachedSchema;
            }
        }