public override Column Build(TableBuilder table, ISchemaProvider schemaBuilder, IList<PostProcess> posts) { Column col = base.Build(table, schemaBuilder, posts); col.IsPrimaryKey = true; col.AllowNull = false; return col; }
private DatabaseSchema(ISchemaProvider schemaProvider, ProviderHelper providerHelper) { _lazyTables = new Lazy<TableCollection>(CreateTableCollection); _lazyProcedures = new Lazy<ProcedureCollection>(CreateProcedureCollection); _schemaProvider = schemaProvider; _providerHelper = providerHelper; }
public CommandBuilder(string text, DatabaseSchema schema, int bulkIndex) { _text = new StringBuilder(text); _schemaProvider = schema.SchemaProvider; _customInterfaceProvider = schema.ProviderHelper; _parameterSuffix = (bulkIndex >= 0) ? "_c" + bulkIndex : string.Empty; }
public StaticModelTypeProvider(string rootNamespace, string assemblyName, INamingRule namingRule, ISchemaProvider schemaProvider) { _rootNamespace = rootNamespace; _assemblyName = assemblyName; _namingRule = namingRule; _schemaProvider = schemaProvider; }
public UniqueConstraintEditorWidget (ISchemaProvider schemaProvider, SchemaActions action) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.action = action; this.Build(); store = new ListStore (typeof (string), typeof (bool), typeof (string), typeof (object)); listUnique.Model = store; listUnique.Selection.Changed += new EventHandler (SelectionChanged); columnSelecter.ColumnToggled += new EventHandler (ColumnToggled); TreeViewColumn colName = new TreeViewColumn (); colName.Title = AddinCatalog.GetString ("Name"); CellRendererText nameRenderer = new CellRendererText (); nameRenderer.Editable = true; nameRenderer.Edited += new EditedHandler (NameEdited); colName.PackStart (nameRenderer, true); colName.AddAttribute (nameRenderer, "text", colNameIndex); listUnique.AppendColumn (colName); ShowAll (); }
public SchemaManager(ISchemaProvider provider, IZetboxContext schema, IZetboxContext savedSchema, ZetboxConfig config) { this.config = config; this.schema = schema; this.db = provider; this.Case = new Cases(schema, provider, savedSchema); }
public ModelSsdl(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ISchemaProvider schemaProvider) : base(_host) { this.ctx = ctx; this.schemaProvider = schemaProvider; }
public static Expression SelectDynamic(ParameterExpression currentContextParam, Expression baseExp, IEnumerable<DataApiNode> fieldExpressions, ISchemaProvider schemaProvider) { Type dynamicType; var memberInit = CreateNewExpression(currentContextParam, fieldExpressions, schemaProvider, out dynamicType); var selector = Expression.Lambda(memberInit, currentContextParam); return Expression.Call(typeof(Enumerable), "Select", new Type[2] { currentContextParam.Type, dynamicType }, baseExp, selector); }
public PartialHelperHandler(ITerrificTemplateHandler handler, ISchemaProvider schemaProvider, ITemplateRepository templateRepository, IClientTemplateGenerator clientTemplateGenerator) { _handler = handler; _schemaProvider = schemaProvider; _templateRepository = templateRepository; _clientTemplateGenerator = clientTemplateGenerator; }
public OutputStream(TableRef tbl, ISchemaProvider provider) { if (tbl == null) throw new ArgumentNullException("tbl"); if (provider == null) throw new ArgumentNullException("provider"); this._provider = provider; this._tbl = tbl; }
public CheckConstraintEditorWidget (ISchemaProvider schemaProvider, SchemaActions action, CheckConstraintEditorSettings settings) { if (settings == null) throw new ArgumentNullException ("settings"); if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.settings = settings; this.action = action; this.Build(); store = new ListStore (typeof (string), typeof (string), typeof (bool), typeof (string), typeof (object)); listCheck.Model = store; TreeViewColumn colName = new TreeViewColumn (); TreeViewColumn colColumn = new TreeViewColumn (); TreeViewColumn colIsColumnConstraint = new TreeViewColumn (); colName.Title = AddinCatalog.GetString ("Name"); colColumn.Title = AddinCatalog.GetString ("Column"); colIsColumnConstraint.Title = AddinCatalog.GetString ("Column Constraint"); colColumn.MinWidth = 120; //request a bigger width CellRendererText nameRenderer = new CellRendererText (); columnRenderer = new CellRendererCombo (); CellRendererToggle isColumnConstraintRenderer = new CellRendererToggle (); nameRenderer.Editable = true; nameRenderer.Edited += new EditedHandler (NameEdited); columnRenderer.TextColumn = SortedColumnListStore.ColNameIndex; columnRenderer.Editable = true; columnRenderer.Edited += new EditedHandler (ColumnEdited); isColumnConstraintRenderer.Activatable = true; isColumnConstraintRenderer.Toggled += new ToggledHandler (IsColumnConstraintToggled); colName.PackStart (nameRenderer, true); colColumn.PackStart (columnRenderer, true); colIsColumnConstraint.PackStart (isColumnConstraintRenderer, true); colName.AddAttribute (nameRenderer, "text", colNameIndex); colColumn.AddAttribute (columnRenderer, "text", colColumnNameIndex); colIsColumnConstraint.AddAttribute (isColumnConstraintRenderer, "active", colIsColumnConstraintIndex); listCheck.AppendColumn (colName); if (settings.SupportsColumnConstraints) listCheck.AppendColumn (colColumn); if (settings.SupportsColumnConstraints && settings.SupportsTableConstraints) listCheck.AppendColumn (colIsColumnConstraint); listCheck.Selection.Changed += new EventHandler (OnSelectionChanged); sqlEditor.TextChanged += new EventHandler (SourceChanged); ShowAll (); }
protected AbstractSchema (ISchemaProvider schemaProvider) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.provider = schemaProvider; }
public LoggingSchemaProviderAdapter(ISchemaProvider provider) { if (provider == null) throw new ArgumentNullException("provider"); _provider = provider; Log = log4net.LogManager.GetLogger("Zetbox.Server.Schema." + provider.ConfigName); }
public ViewEditorDialog (ISchemaProvider schemaProvider, bool create, ViewEditorSettings settings) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) Title = AddinCatalog.GetString ("Create View"); else Title = AddinCatalog.GetString ("Alter View"); notebook = new Notebook (); sqlEditor = new SqlEditorWidget (); sqlEditor.TextChanged += new EventHandler (SqlChanged); notebook.AppendPage (sqlEditor, new Label (AddinCatalog.GetString ("Definition"))); if (settings.ShowComment) { commentEditor = new CommentEditorWidget (); notebook.AppendPage (commentEditor, new Label (AddinCatalog.GetString ("Comment"))); } notebook.Page = 0; entryName.Text = view.Name; vboxContent.PackStart (notebook, true, true, 0); vboxContent.ShowAll (); SetWarning (null); }
private Schema(ISchemaProvider schemaProvider, string urlBase) { _lazyTables = new Lazy<TableCollection>(CreateTableCollection); _lazyFunctions = new Lazy<FunctionCollection>(CreateFunctionCollection); _schemaProvider = schemaProvider; _urlBase = urlBase; }
public DataTypeSchema (ISchemaProvider schemaProvider) : base (schemaProvider) { lengthRange = new Range (0); precisionRange = new Range (0); scaleRange = new Range (0); }
public ColumnSchema (ISchemaProvider schemaProvider, ISchema parent, string name) : base (schemaProvider) { this.constraints = new ConstraintSchemaCollection (); this.parent = parent; this.name = name; }
public MigrationInitializer(IConfiguration configuration, IDatabaseProvider databaseProvider, ISchemaProvider schemaProvider, ICommonTransformations commonTransformations, IConnectionProvider connectionProvider) { _configuration = configuration; _commonTransformations = commonTransformations; _databaseProvider = databaseProvider; _schemaProvider = schemaProvider; _connectionProvider = connectionProvider; }
public void Initialize(MigrationContext context) { _configuration = context.Configuration; _schemaProvider = context.SchemaProvider; _databaseProvider = context.DatabaseProvider; _commonTransformations = context.CommonTransformations; _connectionProvider = context.ConnectionProvider; }
public SchemaManager(ISchemaProvider provider, IZetboxContext schema, IZetboxContext savedSchema, ZetboxConfig config, IEnumerable<IGlobalMigrationFragment> globalMigrationFragments, IEnumerable<IMigrationFragment> migrationFragments) { this.config = config; this.schema = schema; this.db = provider; this._globalMigrationFragments = globalMigrationFragments; this.Case = new Cases(schema, provider, savedSchema, migrationFragments); }
public ModelSsdlEntityTypeColumns(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, IEnumerable<Property> properties, string prefix, ISchemaProvider schemaProvider) : base(_host) { this.ctx = ctx; this.properties = properties; this.prefix = prefix; this.schemaProvider = schemaProvider; }
public TableSchema (ISchemaProvider schemaProvider, string name) : base (schemaProvider) { Name = name; columns = new ColumnSchemaCollection (); constraints = new ConstraintSchemaCollection (); triggers = new TriggerSchemaCollection (); }
public UniqueConstraintEditorWidget (ISchemaProvider schemaProvider, SchemaActions action, TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints) { if (columns == null) throw new ArgumentNullException ("columns"); if (table == null) throw new ArgumentNullException ("table"); if (constraints == null) throw new ArgumentNullException ("constraints"); if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.table = table; this.columns = columns; this.constraints = constraints; this.action = action; this.Build(); store = new ListStore (typeof (string), typeof (bool), typeof (string), typeof (object)); listUnique.Model = store; listUnique.Selection.Changed += new EventHandler (SelectionChanged); columnSelecter.ColumnToggled += new EventHandler (ColumnToggled); TreeViewColumn colName = new TreeViewColumn (); TreeViewColumn colIsColConstraint = new TreeViewColumn (); colName.Title = GettextCatalog.GetString ("Name"); colIsColConstraint.Title = GettextCatalog.GetString ("Column Constraint"); CellRendererText nameRenderer = new CellRendererText (); CellRendererToggle toggleRenderer = new CellRendererToggle (); nameRenderer.Editable = true; nameRenderer.Edited += new EditedHandler (NameEdited); toggleRenderer.Activatable = true; toggleRenderer.Toggled += new ToggledHandler (IsColumnConstraintToggled); colName.PackStart (nameRenderer, true); colIsColConstraint.PackStart (toggleRenderer, true); colName.AddAttribute (nameRenderer, "text", colNameIndex); colIsColConstraint.AddAttribute (toggleRenderer, "active", colIsColumnConstraintIndex); listUnique.AppendColumn (colName); listUnique.AppendColumn (colIsColConstraint); columnSelecter.Initialize (columns); foreach (UniqueConstraintSchema uni in constraints.GetConstraints (ConstraintType.Unique)) AddConstraint (uni); //TODO: also col constraints ShowAll (); }
public static Expression CreateNewExpression(Expression currentContext, IEnumerable<DataApiNode> fieldExpressions, ISchemaProvider schemaProvider, out Type dynamicType) { var fieldExpressionsByName = fieldExpressions.ToDictionary(f => f.Name, f => f.Expression); dynamicType = LinqRuntimeTypeBuilder.GetDynamicType(fieldExpressions.ToDictionary(f => f.Name, f => f.Expression.Type)); var bindings = dynamicType.GetFields().Select(p => Expression.Bind(p, fieldExpressionsByName[p.Name])).OfType<MemberBinding>(); var newExp = Expression.New(dynamicType.GetConstructor(Type.EmptyTypes)); var mi = Expression.MemberInit(newExp, bindings); return mi; }
public IndicesEditorWidget(ISchemaProvider schemaProvider, SchemaActions action) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.action = action; this.Build(); }
public ModelSsdlEntityTypeColumnsRel(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls, IEnumerable<Relation> relations, string prefix, ISchemaProvider schemaProvider) : base(_host) { this.ctx = ctx; this.cls = cls; this.relations = relations; this.prefix = prefix; this.schemaProvider = schemaProvider; }
public SchemaController(IModuleRepository moduleRepository, ITemplateRepository templateRepository, ISchemaProvider schemaProvider, IModuleSchemaProvider moduleSchemaProvider) { _moduleRepository = moduleRepository; _templateRepository = templateRepository; _schemaProvider = schemaProvider; _moduleSchemaProvider = moduleSchemaProvider; }
public AutoCompleter(DataStrategy database) { if (database != null) { var adoAdapter = database.GetAdapter() as AdoAdapter; if (adoAdapter != null) { _schemaProvider = adoAdapter.SchemaProvider; } } }
public static TableRef GetTableRef(this ObjectClass cls, ISchemaProvider provider) { if (cls == null) throw new ArgumentNullException("cls"); if (provider == null) throw new ArgumentNullException("provider"); if (cls.GetTableMapping() == TableMapping.TPH) { cls = cls.GetRootClass(); } return provider.GetTableName(cls.Module.SchemaName, cls.TableName); }
protected AbstractSchema (AbstractSchema schema) { if (schema == null) throw new ArgumentNullException ("schema"); this.provider = schema.provider; this.name = schema.name; this.ownerName = schema.ownerName; this.comment = schema.comment; this.definition = schema.definition; this.schema = schema.schema; }
public ConstraintsEditorWidget(ISchemaProvider schemaProvider, SchemaActions action) { if (schemaProvider == null) { throw new ArgumentNullException("schemaProvider"); } this.schemaProvider = schemaProvider; this.action = action; //TODO: enable/disable features based on schema provider metadata this.Build(); notebook = new Notebook(); Add(notebook); }
private static void BackupContentAsXML(Repository repository) { ITextContentProvider textContentProvider = Providers.DefaultProviderFactory.GetProvider <ITextContentProvider>(); ISchemaProvider schemaProvider = Providers.DefaultProviderFactory.GetProvider <ISchemaProvider>(); if (!(textContentProvider is TextContentProvider)) { ITextContentProvider xmlTextContentProvider = new TextContentProvider(); foreach (var schema in schemaProvider.All(repository)) { xmlTextContentProvider.ImportSchemaData(schema, textContentProvider.ExportSchemaData(schema)); } xmlTextContentProvider.ImportCategoryData(repository, textContentProvider.ExportCategoryData(repository)); } }
private void OnDropDatabaseThreaded(object state) { DatabaseConnectionContext context = (DatabaseConnectionContext)CurrentNode.DataItem; try { context.ConnectionPool.Initialize(); ISchemaProvider provider = context.SchemaProvider; DatabaseSchema db = provider.CreateDatabaseSchema(context.ConnectionSettings.Database); IEditSchemaProvider schemaProvider = (IEditSchemaProvider)context.SchemaProvider; schemaProvider.DropDatabase(db); ConnectionContextService.RemoveDatabaseConnectionContext(context); } catch (Exception ex) { DispatchService.GuiDispatch(delegate { MessageService.ShowException(ex); }); } }
private static TypeElement BuildType(ISchemaProvider schema, GqlTypeInfo typeInfo, Type clrType, bool isInput = false) { // Is collection of objects? var type = new TypeElement(); if (clrType.IsEnumerableOrArray()) { type.Kind = "LIST"; type.Name = null; type.OfType = BuildType(schema, typeInfo, clrType.GetEnumerableOrArrayType(), isInput); } else if (clrType.Name == "EntityQueryType`1") { type.Kind = "SCALAR"; type.Name = "String"; type.OfType = null; } else if (clrType.GetTypeInfo().IsEnum) { type.Kind = "ENUM"; type.Name = typeInfo.SchemaType.Name; type.OfType = null; } else { type.Kind = typeInfo.SchemaType.IsScalar ? "SCALAR" : "OBJECT"; type.OfType = null; if (type.Kind == "OBJECT" && isInput) { type.Kind = "INPUT_OBJECT"; } type.Name = typeInfo.SchemaType.Name; } if (typeInfo.TypeNotNullable) { return(new TypeElement { Kind = "NON_NULL", Name = null, OfType = type }); } return(type); }
public object OnResolved(object resolvedObject) { if (resolvedObject != null) { // Sync content folder if (resolvedObject is TextFolderManager) { ITextFolderProvider textFolderProvider = EngineContext.Current.Resolve <ITextFolderProvider>(); TextFolderManager textFolderManager = (TextFolderManager)resolvedObject; ISiteProvider siteProvider = EngineContext.Current.Resolve <ISiteProvider>(); return(new TextFolderManagerWrapper(textFolderProvider, textFolderManager, siteProvider)); } // Sync content schema if (resolvedObject is ISchemaProvider) { ISchemaProvider schemaProvider = (ISchemaProvider)resolvedObject; ISiteProvider siteProvider = EngineContext.Current.Resolve <ISiteProvider>(); return(new SchemaProviderWrapper(schemaProvider, siteProvider)); } if (resolvedObject is SchemaManager) { ISchemaProvider schemaProvider = EngineContext.Current.Resolve <ISchemaProvider>(); SchemaManager schemaManager = (SchemaManager)resolvedObject; ISiteProvider siteProvider = EngineContext.Current.Resolve <ISiteProvider>(); return(new SchemaManagerWrapper(schemaProvider, schemaManager, siteProvider)); } // Sync site setting if (resolvedObject is SiteManager) { ISiteProvider siteProvider = EngineContext.Current.Resolve <ISiteProvider>(); IRepositoryProvider repositoryProvider = EngineContext.Current.Resolve <IRepositoryProvider>(); SiteManagerWrapper siteManagerWrapper = new SiteManagerWrapper(siteProvider, repositoryProvider); return(siteManagerWrapper); } } return(resolvedObject); }
private static async Task PrintTablesAsync(ILogging logger, string database, ISchemaProvider schemaProvider, ITable table) { logger.Log($"TABLE {table.Name}:", LogType.Information); var columns = await schemaProvider.GetColumnsAsync(database, table.Name); foreach (var column in columns) { logger.Log($" COLUMN {column.Name} ({column.DataType}){(column.IsIdentity ? " IDENTITY" : "")}{(column.IsNullable ? " NULLABLE" : "")}"); } var constraints = await schemaProvider.GetConstraintsAsync(database, table.Name); foreach (var constraint in constraints) { logger.Log($" CONSTRAINT {constraint.Name} ({constraint.Type})"); } }
public void Initialize(PropertyInfo propertyInfo, object propertyInfoResolutionObject, ISchemaProvider schemaProvider) { var foundMutableField = propertyInfo.GetValue(propertyInfoResolutionObject, null); var assignableMutableField = foundMutableField as MutableTarget; MutableTarget = assignableMutableField; SchemaProvider = schemaProvider; StringKeyLabelText = ControllableUtility.GetControllableLabel(propertyInfo) + " Value Name"; MutableLabelText = ControllableUtility.GetControllableLabel(propertyInfo) + " Path"; PopulateInitialValue(); }
private static List <TypeElement> BuildQueryTypes(ISchemaProvider schema) { var types = new List <TypeElement>(); foreach (var st in schema.GetNonContextTypes().Where(s => !s.IsInput && !s.IsEnum && !s.IsScalar)) { var typeElement = new TypeElement { Kind = "OBJECT", Name = st.Name, Description = st.Description }; types.Add(typeElement); } return(types); }
private static IEnumerable <TypeElement> BuildScalarTypes(ISchemaProvider schema, IReadOnlyDictionary <Type, string> combinedMapping) { var types = new List <TypeElement>(); foreach (var customScalar in schema.CustomScalarTypes) { var typeElement = new TypeElement { Kind = "SCALAR", Name = customScalar, Description = null, }; types.Add(typeElement); } return(types); }
private static List <Directive> BuildDirectives(ISchemaProvider schema) { var directives = schema.GetDirectives().Select(directive => new Directive { Name = directive.Name, Description = directive.Description, Locations = new string[] { "FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT" }, Args = directive.GetArguments(schema).Select(arg => new InputValue { Name = arg.Name, Description = arg.Description, DefaultValue = null, Type = BuildType(schema, arg.Type, arg.Type.TypeDotnet, true), }).ToArray() }).ToList(); return(directives); }
private static List <TypeElement> BuildQueryTypes(ISchemaProvider schema, IReadOnlyDictionary <Type, string> combinedMapping) { var types = new List <TypeElement>(); foreach (var st in schema.GetNonContextTypes().Where(s => !s.IsInput && !s.IsEnum)) { var typeElement = new TypeElement { Kind = "OBJECT", Name = st.Name, Description = st.Description }; types.Add(typeElement); } return(types); }
private static IEnumerable <TypeElement> BuildScalarTypes(ISchemaProvider schema) { var types = new List <TypeElement>(); foreach (var customScalar in schema.GetScalarTypes()) { var typeElement = new TypeElement { Kind = "SCALAR", Name = customScalar.Name, Description = null, }; types.Add(typeElement); } return(types); }
/// <summary> /// Compile a query. /// </summary> /// <param name="query">The query text</param> /// <param name="schemaProvider"></param> /// <param name="methodProvider"></param> /// <returns></returns> public static CompiledQueryResult Compile(string query, ISchemaProvider schemaProvider, ClaimsIdentity claims, IMethodProvider methodProvider, QueryVariables variables) { ParameterExpression contextParam = null; if (schemaProvider != null) { contextParam = Expression.Parameter(schemaProvider.ContextType); } var expression = CompileQuery(query, contextParam, schemaProvider, claims, methodProvider, variables); var contextParams = new List <ParameterExpression>(); if (contextParam != null) { contextParams.Add(contextParam); } return(new CompiledQueryResult(expression, contextParams)); }
private static string MakeQueryType(ISchemaProvider schema) { var sb = new StringBuilder(); foreach (var t in schema.GetQueryFields().OrderBy(s => s.Name)) { if (t.Name.StartsWith("__")) { continue; } if (!string.IsNullOrEmpty(t.Description)) { sb.AppendLine($"\t\"\"\"{EscapeString(t.Description)}\"\"\""); } sb.AppendLine($"\t{ToCamelCaseStartsLower(t.Name)}{GetGqlArgs(t)}: {t.ReturnType.GqlTypeForReturnOrArgument}"); } return(sb.ToString()); }
private static EntityField ToEntityField(ISchemaProvider schemaProvider, FieldInfo fieldInfo, int prefixLength) { string flags; if (fieldInfo.IsIdentity) { flags = "Identity"; } else if (fieldInfo.IsPrimaryKey) { flags = "PrimaryKey"; } else if (fieldInfo.DataType == "timestamp" || fieldInfo.DataType == "rowversion") { flags = "Insertable(false), Updatable(false), NotNull"; } else if (!fieldInfo.IsNullable) { flags = "NotNull"; } else { flags = null; } string dataType; var fieldType = schemaProvider.SqlTypeNameToFieldType(fieldInfo.DataType, fieldInfo.Size, out dataType); dataType = dataType ?? fieldType; return(new EntityField { FieldType = fieldType, DataType = dataType, IsValueType = fieldType != "String" && fieldType != "Stream" && fieldType != "ByteArray", TSType = FieldTypeToTS(fieldType), Ident = GenerateVariableName(fieldInfo.FieldName.Substring(prefixLength)), Title = Inflector.Inflector.Titleize(fieldInfo.FieldName.Substring(prefixLength)), Flags = flags, Name = fieldInfo.FieldName, Size = fieldInfo.Size == 0 ? (Int32?)null : fieldInfo.Size, Scale = fieldInfo.Scale }); }
public override Column Build(TableBuilder table, ISchemaProvider schemaProvider, IList <PostProcess> posts) { Column col = base.Build(table, schemaProvider, posts); posts.Add(new PostProcess( delegate() { string fkName = "FK_" + SchemaUtils.Normalize(table.Name) + "_" + SchemaUtils.Normalize(col.Name) + "_" + SchemaUtils.Normalize(targetColName); schemaProvider.AddForeignKeyConstraint( table.Name, fkName, col.Name, targetTable, targetColName); })); return(col); }
public ContentCommandMiddleware( IAggregateHandler handler, IAppProvider appProvider, IAssetRepository assetRepository, ISchemaProvider schemas, IContentRepository contentRepository) { Guard.NotNull(handler, nameof(handler)); Guard.NotNull(schemas, nameof(schemas)); Guard.NotNull(appProvider, nameof(appProvider)); Guard.NotNull(assetRepository, nameof(assetRepository)); Guard.NotNull(contentRepository, nameof(contentRepository)); this.handler = handler; this.schemas = schemas; this.appProvider = appProvider; this.assetRepository = assetRepository; this.contentRepository = contentRepository; }
public MigrationTasksBase(IZetboxContext logCtx, ISchemaProvider src, ISchemaProvider dst) { if (src == null) { throw new ArgumentNullException("src"); } if (dst == null) { throw new ArgumentNullException("dst"); } if (logCtx == null) { throw new ArgumentNullException("logCtx"); } _src = src; _dst = dst; _logCtx = logCtx; }
private static List <InputValue> BuildArgs(ISchemaProvider schema, IField field) { var args = new List <InputValue>(); foreach (var arg in field.Arguments) { var type = BuildType(schema, arg.Value.Type, arg.Value.Type.TypeDotnet, true); args.Add(new InputValue { Name = arg.Key, Type = type, DefaultValue = null, Description = null, }); } return(args); }
public ViewEditorDialog(ISchemaProvider schemaProvider, bool create, ViewEditorSettings settings) { if (schemaProvider == null) { throw new ArgumentNullException("schemaProvider"); } this.schemaProvider = schemaProvider; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) { Title = AddinCatalog.GetString("Create View"); } else { Title = AddinCatalog.GetString("Alter View"); } notebook = new Notebook(); sqlEditor = new SqlEditorWidget(); sqlEditor.TextChanged += new EventHandler(SqlChanged); notebook.AppendPage(sqlEditor, new Label(AddinCatalog.GetString("Definition"))); if (settings.ShowComment) { commentEditor = new CommentEditorWidget(); notebook.AppendPage(commentEditor, new Label(AddinCatalog.GetString("Comment"))); } notebook.Page = 0; entryName.Text = view.Name; vboxContent.PackStart(notebook, true, true, 0); vboxContent.ShowAll(); SetWarning(null); }
private static string MakeQueryType(ISchemaProvider schema, IReadOnlyDictionary <Type, string> combinedMapping) { var sb = new StringBuilder(); foreach (var t in schema.GetQueryFields().OrderBy(s => s.Name)) { if (t.Name.StartsWith("__")) { continue; } var typeName = GetGqlReturnType(t, schema, combinedMapping); if (!string.IsNullOrEmpty(t.Description)) { sb.AppendLine($"\t\"{t.Description}\""); } sb.AppendLine($"\t{ToCamelCaseStartsLower(t.Name)}{GetGqlArgs(t, schema, combinedMapping)}: {typeName}"); } return(sb.ToString()); }
private static List <Models.InputValue> BuildArgs(ISchemaProvider schema, IReadOnlyDictionary <Type, string> combinedMapping, IMethodType field) { var args = new List <Models.InputValue>(); foreach (var arg in field.Arguments) { var gqlTypeName = arg.Value.Type.IsEnumerableOrArray() ? arg.Value.Type.GetEnumerableOrArrayType().Name : arg.Value.Type.Name; var type = BuildType(schema, arg.Value.Type, gqlTypeName, combinedMapping); args.Add(new Models.InputValue { Name = arg.Key, Type = type, DefaultValue = null, Description = null, }); } return(args); }
public SchemaFactory(IDistributedCacheWrapper distributedCache, ISchemaProvider schemaProvider, ILookupSchemaTransformFactory lookupSchemaFactory, IReusableElementSchemaTransformFactory reusableElementSchemaFactory, IOptions <DistributedCacheConfiguration> distributedCacheConfiguration, IOptions <DistributedCacheExpirationConfiguration> distributedCacheExpirationConfiguration, IConfiguration configuration, IFormSchemaIntegrityValidator formSchemaIntegrityValidator, IEnumerable <IUserPageTransformFactory> userPageTransformFactories) { _distributedCache = distributedCache; _schemaProvider = schemaProvider; _lookupSchemaFactory = lookupSchemaFactory; _reusableElementSchemaFactory = reusableElementSchemaFactory; _distributedCacheConfiguration = distributedCacheConfiguration.Value; _distributedCacheExpirationConfiguration = distributedCacheExpirationConfiguration.Value; _configuration = configuration; _formSchemaIntegrityValidator = formSchemaIntegrityValidator; _userPageTransformFactories = userPageTransformFactories; }
public void Initialize(PropertyInfo propertyInfo, object propertyInfoResolutionObject, ISchemaProvider schemaProvider) { var foundScope = propertyInfo.GetValue(propertyInfoResolutionObject, null); var assignableScope = foundScope as MutableScope; Scope = assignableScope; SchemaProvider = schemaProvider; LabelText = ControllableUtility.GetControllableLabel(propertyInfo); if (!ShowLabel) { LabelComponent.gameObject.SetActive(false); MainContentsPanel.offsetMin = new Vector2(16, MainContentsPanel.offsetMin.y); } PopulateInitialValue(); }
/// <summary> /// Creates an Introspection schema /// </summary> /// <param name="schema"></param> /// <param name="typeMappings"></param> /// <returns></returns> public static Models.Schema Make(ISchemaProvider schema, IReadOnlyDictionary <Type, string> combinedMapping) { var types = new List <Models.TypeElement> { new TypeElement { Description = "The query type, represents all of the entry points into our object graph", Kind = "OBJECT", Name = "Query", OfType = null, }, new TypeElement { Description = "The mutation type, represents all updates we can make to our data", Kind = "OBJECT", Name = "Mutation", OfType = null, }, }; types.AddRange(BuildQueryTypes(schema, combinedMapping)); types.AddRange(BuildInputTypes(schema, combinedMapping)); types.AddRange(BuildEnumTypes(schema, combinedMapping)); types.AddRange(BuildScalarTypes(schema, combinedMapping)); var schemaDescription = new Models.Schema { QueryType = new Models.TypeElement { Name = "Query" }, MutationType = new Models.TypeElement { Name = "Mutation" }, Types = types.OrderBy(x => x.Name).ToArray(), Directives = BuildDirectives().ToArray() }; return(schemaDescription); }
private static List <TypeElement> BuildEnumTypes(ISchemaProvider schema) { var types = new List <TypeElement>(); foreach (ISchemaType schemaType in schema.GetNonContextTypes().Where(s => s.IsEnum)) { var typeElement = new TypeElement { Kind = "ENUM", Name = schemaType.Name, Description = schemaType.Description, EnumValues = new EnumValue[] { } }; if (schemaType.Name.StartsWith("__")) { continue; } var enumTypes = new List <EnumValue>(); //filter to ENUM type ONLY! foreach (Field field in schemaType.GetFields()) { enumTypes.Add(new EnumValue { Name = field.Name, Description = field.Description, IsDeprecated = false, DeprecationReason = null }); } typeElement.EnumValues = enumTypes.ToArray(); if (typeElement.EnumValues.Count() > 0) { types.Add(typeElement); } } return(types); }
/// <summary> /// Creates an Introspection schema /// </summary> /// <param name="schema"></param> /// <param name="typeMappings"></param> /// <returns></returns> public static Schema Make(ISchemaProvider schema) { var types = new List <TypeElement> { new TypeElement { Description = "The query type, represents all of the entry points into our object graph", Kind = "OBJECT", Name = "Query", OfType = null, }, new TypeElement { Description = "The mutation type, represents all updates we can make to our data", Kind = "OBJECT", Name = "Mutation", OfType = null, }, }; types.AddRange(BuildQueryTypes(schema)); types.AddRange(BuildInputTypes(schema)); types.AddRange(BuildEnumTypes(schema)); types.AddRange(BuildScalarTypes(schema)); var schemaDescription = new Schema { QueryType = new TypeElement { Name = "Query" }, MutationType = new TypeElement { Name = "Mutation" }, Types = types.OrderBy(x => x.Name).ToList(), Directives = BuildDirectives(schema) }; return(schemaDescription); }
private static List <InputValue> BuildArgs(ISchemaProvider schema, CombinedMapping combinedMapping, IMethodType field) { var args = new List <InputValue>(); foreach (var arg in field.Arguments) { Type clrType = arg.Value.Type.GetNonNullableType(); var gqlTypeName = clrType.IsEnumerableOrArray() ? clrType.GetEnumerableOrArrayType().Name : clrType.Name; var type = BuildType(schema, clrType, gqlTypeName, combinedMapping, true); args.Add(new InputValue { Name = arg.Key, Type = type, DefaultValue = null, Description = null, }); } return(args); }
public Schema GetSchema(KeyedCollection <string, ConfigParameter> configParameters) { try { Logging.SetupLogger(configParameters); SchemaContext context = new SchemaContext() { ConfigParameters = configParameters, ConnectionContext = InterfaceManager.GetProviderOrDefault <IConnectionContextProvider>()?.GetConnectionContext(configParameters, ConnectionContextOperationType.Schema) }; ISchemaProvider provider = InterfaceManager.GetProviderOrThrow <ISchemaProvider>(); return(provider.GetMmsSchema(context)); } catch (Exception ex) { logger.Error(ex.UnwrapIfSingleAggregateException(), "Could not retrieve schema"); throw; } }
private void CopyData(Repository sourceRepository, Repository destRepository) { ITextContentProvider textContentProvider = Providers.DefaultProviderFactory.GetProvider <ITextContentProvider>(); ISchemaProvider schemaProvider = Providers.DefaultProviderFactory.GetProvider <ISchemaProvider>(); foreach (var schema in schemaProvider.All(sourceRepository)) { var items = textContentProvider.ExportSchemaData(schema).ToArray(); foreach (var item in items) { item["OriginalUUID"] = item["UUID"]; item["OriginalRepository"] = sourceRepository.Name; item["OriginalFolder"] = item["FolderName"]; item["IsLocalized"] = false; } //switch to dest repository to import the data; schema.Repository = destRepository; textContentProvider.ImportSchemaData(schema, items); } textContentProvider.ImportCategoryData(destRepository, textContentProvider.ExportCategoryData(sourceRepository)); }