private static SchemaDetails _checkSchemaVersion(CswNbtResources CswNbtResources) { SchemaDetails Ret = new SchemaDetails(); CswSchemaScriptsProd CswSchemaScriptsProd = new CswSchemaScriptsProd(CswNbtResources); CswSchemaVersion CurrentVersion = CswSchemaScriptsProd.CurrentVersion(CswNbtResources); CswSchemaVersion LatestVersion = CswSchemaScriptsProd.LatestVersion; if (CurrentVersion < LatestVersion) { Ret.CorrectVersion = false; CswWebSvcReturnBase.ErrorMessage Error = new CswWebSvcReturnBase.ErrorMessage(); Error.Type = CswEnumErrorType.Error; Error.Message = "The current schema is not updated to the latest version. The application may not work correctly. Please contact your adminstrator."; Error.Detail = "The current schema is at version " + CurrentVersion + " and the latest version is version " + LatestVersion + "."; Ret.ErrorMessage = Error; } else { Ret.CorrectVersion = true; } return(Ret); }
public static void getDefaults(ICswResources CswResources, CswNbtAuthReturn Ret, CswWebSvcSessionAuthenticateData.Authentication.Request Request) { getUserDefaults(CswResources, Ret, Request); SchemaDetails SchemaDetails = _checkSchemaVersion((CswNbtResources)CswResources); Ret.Data.SchemaData = SchemaDetails; }
private ChangeScript GenerateSchemas(SchemaDetails schema) { var builder = new StringBuilder(); if (_historyCommonConfiguration.IncludeDropOrAlterStatements) { builder.AppendFormat( @"IF NOT EXISTS (SELECT 1 FROM sys.schemas WHERE name = '{0}') EXEC('CREATE SCHEMA [{0}]'); GO ", schema.Name); } else { builder.AppendFormat( @" CREATE SCHEMA [{0}] GO ", schema.Name); } return(new ChangeScript() { Name = schema.Name, Schema = schema.Schema, ScriptText = builder.ToString(), ScriptType = ScriptType.Schema, State = schema.State }); }
public static SchemaDetails ToDetails(this DataSchema schema) { var result = new SchemaDetails(); result.public_id = schema.PublicID; result.name = schema.Name; result.description = schema.Description; result.is_aggregate = schema.IsAggregate; return(result); }
public ISchemaDetails GetProviderConfigurationSchema() { if (_providerConfigurationSchema == null) { // We expect at most 1 type to be discovered here var configTypes = PluginAssembly.GetExportedTypes() .Select(type => new { Type = type, Attr = type.GetCustomAttribute <TFProviderConfigurationAttribute>() }) .Where(t_a => t_a.Attr != null) .ToArray(); // Only a single class may be marked as *the* Provider configuration if (configTypes.Length > 1) { throw new InvalidOperationException( "Multiple provider configuration types discovered, at most one supported"); } _providerConfigurationSchema = new SchemaDetails { Name = string.Empty, }; if (configTypes.Length == 1) { _providerConfigurationSchema.Type = configTypes[0].Type; _providerConfigurationSchema.Attribute = configTypes[0].Attr; } else { _log.LogWarning("No provider configuration type found, assuming no configuration"); _providerConfigurationSchema.Type = typeof(object); _providerConfigurationSchema.Attribute = new TFProviderConfigurationAttribute(); } _log.LogInformation("Resolved provider configuration type [{type}]", _providerConfigurationSchema.Type); _providerConfigurationSchema.Schema = GetSchemaFromType <TFProviderConfigurationAttribute>( _providerConfigurationSchema.Type, (type, attr) => { return(new Schema { Version = attr.Version, Block = new Schema.Types.Block(), }); }); } return(_providerConfigurationSchema); }
public CswNbtUserDefaultsData() { SchemaData = new SchemaDetails(); }