public CachedSchema(CachedSchema cached) { DbSchema = new XElement(cached.DbSchema); RevisedDbSchema = new XElement(cached.RevisedDbSchema); MappedSchema = new XElement(cached.MappedSchema); RevisedSchema = new XElement(cached.RevisedSchema); }
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); }
public void Update(string name, SchemaSource source) { CachedSchema cachedSchema = NewCachedSchema(name, source); lock (LockObj) { Cache[name] = cachedSchema; } }