public SchemaBuilder(DbConnection connection, DbTransaction transaction, string tablePrefix) { _builder = SchemaBuilderFactory.For(connection); _tablePrefix = tablePrefix; Connection = connection; Transaction = transaction; }
private DataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder) { TraceHelper.Current.CorrelateWithActivity(EtwActivity.GetActivityId()); try { this.Configuration = settings; this.cmdManagers = new Dictionary<ManagementSystemType, ICommandManager>(); this.PerfCounters = new PerfCounters(CurrentRequestHelper.EndPointAddress); this.UserDataCache = new UserDataCache(this.Configuration.Invocation.Lifetime); this.QuotaSystem = new QuotaSystem(); InitialSessionStateManager initialSessionStateManager = new InitialSessionStateManager(this.Configuration.PowerShell.SessionConfig.Assembly, this.Configuration.PowerShell.SessionConfig.Type); this.intialSessionStateStore = new SharedItemStore<InitialSessionState, UserContext>(initialSessionStateManager, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas); PSRunspaceFactory pSRunspaceFactory = new PSRunspaceFactory(this.intialSessionStateStore, true); int runspaceTimeout = this.Configuration.PowerShell.Quotas.RunspaceTimeout; ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces); PSCommandManager pSCommandManager = new PSCommandManager(exclusiveItemStore); this.cmdManagers.Add(ManagementSystemType.PowerShell, pSCommandManager); PSRunspaceFactory pSRunspaceFactory1 = new PSRunspaceFactory(this.intialSessionStateStore, false); ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore1 = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory1, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces); this.cmdManagers.Add(ManagementSystemType.GenericInvoke, new GICommandManager(exclusiveItemStore1)); List<ISchemaBuilder> schemaBuilders = new List<ISchemaBuilder>(); if (testSchemaBuilder != null) { schemaBuilders.Add(testSchemaBuilder); } schemaBuilders.Add(new PSSchemaBuilder(exclusiveItemStore)); schemaBuilders.Add(new GISchemaBuilder()); SchemaFactory schemaFactory = new SchemaFactory(this.Configuration.SchemaFileName, this.Configuration.ResourceMappingFileName, schemaBuilders, settings); this.schemaStore = new SharedItemStore<Microsoft.Management.Odata.Schema.Schema, UserContext>(schemaFactory, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas); this.customAuthorizationHandler = new CustomAuthorizationHandler(this.Configuration.CustomAuthorization.Assembly, this.Configuration.CustomAuthorization.Type, customContextStore); } catch (Exception exception1) { Exception exception = exception1; TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message); if (TraceHelper.IsEnabled(5)) { TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create")); } if (this.PerfCounters != null) { this.PerfCounters.Dispose(); } throw; } TraceHelper.Current.DataServiceControllerCreationSucceeded(); }
protected ISchema CreateSchemaWith( IFilterInputType type, FilterConvention convention, params FilterConventionExtension[] extensions) { ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <IFilterConvention>(convention) .AddFiltering() .AddQueryType( c => c.Name("Query") .Field("foo") .Type <StringType>() .Resolver("bar")) .AddType(type); foreach (var extension in extensions) { builder.AddConvention <IFilterConvention>(extension); } return(builder.Create()); }
protected ExecutorBuilder CreateProviderTester <TRuntimeType>( SortInputType <TRuntimeType> type, SortConvention?convention = null) { convention ??= new SortConvention( x => x.AddDefaults().BindRuntimeType(typeof(TRuntimeType), type.GetType())); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <ISortConvention>(convention) .TryAddTypeInterceptor <SortTypeInterceptor>() .AddQueryType( c => c.Name("Query") .Field("foo") .Type <StringType>() .Resolve("bar")) .AddType(type); builder.Create(); return(new ExecutorBuilder(type)); }
private static void BuildNameLookup( IDescriptorContext context, ISchemaBuilder schemaBuilder, DocumentNode document, ICollection <NameString> schemaNames) { Dictionary <(NameString Type, NameString TargetSchema), NameString> nameLookup = new Dictionary <(NameString, NameString), NameString>(); foreach (INamedSyntaxNode type in document.Definitions.OfType <INamedSyntaxNode>()) { foreach (DirectiveNode directive in type.Directives .Where(t => t.Name.Value.EqualsOrdinal(DirectiveNames.Source))) { if (directive.Arguments.FirstOrDefault( t => t.Name.Value.EqualsOrdinal(Source_Schema))?.Value is StringValueNode schema && directive.Arguments.FirstOrDefault( t => t.Name.Value.EqualsOrdinal(Source_Name))?.Value is StringValueNode name && !name.Value.EqualsOrdinal(type.Name.Value)) { nameLookup[(type.Name.Value, schema.Value)] = name.Value;
protected IRequestExecutor CreateSchema <TEntity, T>( TEntity[] entities, FilterConvention?convention = null) where TEntity : class where T : FilterInputType <TEntity> { convention ??= new FilterConvention(x => x.AddDefaults().BindRuntimeType <TEntity, T>()); Func <IResolverContext, IEnumerable <TEntity> >?resolver = BuildResolver(entities); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <IFilterConvention>(convention) .AddFiltering() .AddQueryType(c => c .Name("Query") .Field("root") .Resolver(resolver) .UseFiltering <T>()); ISchema?schema = builder.Create(); return(schema.MakeExecutable()); }
protected ISchema CreateSchemaWithTypes( ISortInputType type, SortConvention convention, params Type[] extensions) { ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <ISortConvention>(convention) .AddSorting() .AddQueryType( c => c.Name("Query") .Field("foo") .Type <StringType>() .Resolve("bar")) .AddType(type); foreach (Type?extension in extensions) { builder.AddConvention <ISortConvention>(extension); } return(builder.Create()); }
public static ISchemaBuilder AddTypes(this ISchemaBuilder builder) { builder .AddType <MediaTypeEnum>() .AddType <InterviewType> () .AddType <UserType> () .AddType <MultipleChoiceQuestionType>() .AddType <TextQuestionType>() .AddType <RangeQuestionType>() .AddType <TextAnswerFormatType>() .AddType <VideoAnswerFormatType>() .AddType <AudioAnswerFormatType>() .AddType <RangeOptionInputType>() .AddType <AttachmentInputType>() .AddType <OptionInputType>() .AddType <TextQuestionInputType>() .AddType <InterchangeTemplateCreateCommandInputType>() .AddType <InterviewRoundCreateCommandInputType>() .AddType <InterviewCreateCommandInputType>() .AddQueryType <RootQuery>() .AddMutationType <Mutation>(); return(builder); }
protected ISchema CreateSchema <T>(T type) where T : IFilterInputType { var convention = new FilterConvention(x => x .AddDefaults() .AddSpatialOperations() .BindSpatialTypes() .Provider( new QueryableFilterProvider( p => p.AddSpatialHandlers().AddDefaultFieldHandlers()))); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <IFilterConvention>(convention) .TryAddTypeInterceptor <FilterTypeInterceptor>() .AddQueryType(c => c .Name("Query") .Field("foo") .Type <StringType>() .Resolver("bar")) .AddType(type); return(builder.Create()); }
private async ValueTask <ISchema> CreateSchemaAsync( NameString schemaName, RequestExecutorSetup options, IServiceProvider serviceProvider, CancellationToken cancellationToken) { if (options.Schema is not null) { AssertSchemaNameValid(options.Schema, schemaName); return(options.Schema); } ISchemaBuilder schemaBuilder = options.SchemaBuilder ?? new SchemaBuilder(); schemaBuilder.AddServices(serviceProvider); foreach (SchemaBuilderAction action in options.SchemaBuilderActions) { if (action.Action is { } configure) { configure(serviceProvider, schemaBuilder); } if (action.AsyncAction is { } configureAsync) { await configureAsync(serviceProvider, schemaBuilder, cancellationToken) .ConfigureAwait(false); } } schemaBuilder.TryAddTypeInterceptor(new SetSchemaNameInterceptor(schemaName)); ISchema schema = schemaBuilder.Create(); AssertSchemaNameValid(schema, schemaName); return(schema); }
public async Task InitializeAsync(IStore store, ISchemaBuilder builder) { _dialect = SqlDialectFactory.For(store.Configuration.ConnectionFactory.DbConnectionType); _tablePrefix = store.Configuration.TablePrefix; _store = store; SelectCommand = "SELECT " + _dialect.QuoteForColumnName("nextval") + " FROM " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " WHERE " + _dialect.QuoteForTableName("dimension") + " = " + _dialect.QuoteForParameter("dimension") + _dialect.StatementEnd; UpdateCommand = "UPDATE " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " SET " + _dialect.QuoteForColumnName("nextval") + " = " + _dialect.QuoteForParameter("new") + " WHERE " + _dialect.QuoteForColumnName("nextval") + " = " + _dialect.QuoteForParameter("previous") + " AND " + _dialect.QuoteForColumnName("dimension") + " = " + _dialect.QuoteForParameter("dimension") + _dialect.StatementEnd; InsertCommand = "INSERT INTO " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " (" + _dialect.QuoteForColumnName("dimension") + ", " + _dialect.QuoteForColumnName("nextval") + ") VALUES(" + _dialect.QuoteForParameter("dimension") + ", " + _dialect.QuoteForParameter("nextval") + ")" + _dialect.StatementEnd; using (var connection = store.Configuration.ConnectionFactory.CreateConnection()) { await connection.OpenAsync(); try { using (var transaction = connection.BeginTransaction()) { var localBuilder = new SchemaBuilder(store.Configuration, transaction, false); localBuilder.CreateTable(DbBlockIdGenerator.TableName, table => table .Column <string>("dimension", column => column.PrimaryKey().NotNull()) .Column <ulong>("nextval") ) //.AlterTable(DbBlockIdGenerator.TableName, table => table //FIXME Oracle // .CreateIndex("IX_Dimension", "dimension") //) ; transaction.Commit(); } } catch { } } }
protected IRequestExecutor CreateSchema <TEntity, T>( TEntity?[] entities, SortConvention?convention = null, Action <ISchemaBuilder>?configure = null) where TEntity : class where T : SortInputType <TEntity> { convention ??= new SortConvention(x => x.AddDefaults().BindRuntimeType <TEntity, T>()); Func <IResolverContext, IEnumerable <TEntity> >?resolver = BuildResolver(entities !); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <ISortConvention>(convention) .AddSorting() .AddQueryType( c => { c .Name("Query") .Field("root") .Resolve(resolver) .UseSorting <T>(); c .Name("Query") .Field("rootExecutable") .Resolve(ctx => resolver(ctx).AsExecutable()) .UseSorting <T>(); }); configure?.Invoke(builder); ISchema?schema = builder.Create(); return(schema.MakeExecutable()); }
public static ISchemaBuilder AddSchemaRegistry( this ISchemaBuilder builder, bool addRootTypes = true) { if (addRootTypes) { builder .AddQueryType(d => d.Name("Query")) .AddMutationType(d => d.Name("Mutation")) .AddSubscriptionType(d => d.Name("Subscription")); } return(builder .AddType <EnvironmentQueries>() .AddType <EnvironmentMutations>() .AddType <SchemaQueries>() .AddType <SchemaMutations>() .AddType <SchemaSubscriptions>() .AddType <SchemaExtension>() .AddType <SchemaVersionExtension>() .AddType <SchemaPublishReportExtension>() .BindClrType <string, StringType>() .BindClrType <Guid, IdType>()); }
public async Task InitializeAsync(IStore store, ISchemaBuilder builder) { _dialect = store.Dialect; _tablePrefix = store.Configuration.TablePrefix; _store = store; SelectCommand = "SELECT " + _dialect.QuoteForColumnName("nextval") + " FROM " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " WHERE " + _dialect.QuoteForTableName("dimension") + " = @dimension;"; UpdateCommand = "UPDATE " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " SET " + _dialect.QuoteForColumnName("nextval") + "=@new WHERE " + _dialect.QuoteForColumnName("nextval") + " = @previous AND " + _dialect.QuoteForColumnName("dimension") + " = @dimension;"; InsertCommand = "INSERT INTO " + _dialect.QuoteForTableName(_tablePrefix + TableName) + " (" + _dialect.QuoteForColumnName("dimension") + ", " + _dialect.QuoteForColumnName("nextval") + ") VALUES(@dimension, @nextval);"; using (var connection = store.Configuration.ConnectionFactory.CreateConnection()) { await connection.OpenAsync(); try { using (var transaction = connection.BeginTransaction(store.Configuration.IsolationLevel)) { var localBuilder = new SchemaBuilder(store.Configuration, transaction, false); localBuilder.CreateTable(DbBlockIdGenerator.TableName, table => table .Column <string>("dimension", column => column.PrimaryKey().NotNull()) .Column <ulong>("nextval") ) .AlterTable(DbBlockIdGenerator.TableName, table => table .CreateIndex("IX_Dimension", "dimension") ); transaction.Commit(); } } catch { } } }
public void Convention_DefaultScope_Extensions_Enum() { // arrange // act var convention = new SortConvention( x => x.UseMock() .ConfigureEnum <DefaultSortEnumType>(y => y.Operation(123)) .Operation(123).Name("test")); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <ISortConvention>(convention) .TryAddTypeInterceptor <SortTypeInterceptor>() .AddQueryType(c => c.Name("Query") .Field("foo") .Type <StringType>() .Resolver("bar") .Argument("test", x => x.Type <TestSort>())); ISchema schema = builder.Create(); // assert schema.ToString().MatchSnapshot(); }
public static ISchemaBuilder AddInputObjectType <T>( this ISchemaBuilder builder, Action <IInputObjectTypeDescriptor <T> > configure) { if (builder is null) { throw new ArgumentNullException(nameof(builder)); } if (configure is null) { throw new ArgumentNullException(nameof(configure)); } if (typeof(T).IsSchemaType() || typeof(T).IsNonGenericSchemaType()) { throw new InvalidOperationException( string.Format( TypeResources.SchemaBuilderExtensions_AddInputObjectType_TIsSchemaType, typeof(T).FullName)); } return(builder.AddType(new InputObjectType <T>(configure))); }
/// <summary> /// Adds the ability for this graphql server to raise subscription events that can be published. /// </summary> /// <typeparam name="TSchema">The type of schema being configured.</typeparam> /// <param name="schemaBuilder">The schema builder.</param> /// <returns>GraphQL.AspNet.Interfaces.Configuration.ISchemaBuilder<TSchema>.</returns> public static ISchemaBuilder <TSchema> AddSubscriptionPublishing <TSchema>( this ISchemaBuilder <TSchema> schemaBuilder) where TSchema : class, ISchema { var extension = new SubscriptionPublisherSchemaExtension <TSchema>(); // register the in-process publisher to the service collection before // if one is not already registered var defaultPublisher = CreateDefaultSubscriptionPublisherDescriptor(); extension.OptionalServices.Add(defaultPublisher); // register the internal queueing mechanism that will asyncrounously transfer // raised events from controller methods to the registered subscription publisher schemaBuilder.AsServiceCollection().AddSingleton <SubscriptionEventQueue>(); schemaBuilder.AsServiceCollection().AddHostedService <SubscriptionPublicationService>(); schemaBuilder.AsServiceCollection().TryAdd(CreateDefaultSubscriptionRouterDescriptor()); schemaBuilder.Options.RegisterExtension(extension); schemaBuilder.QueryExecutionPipeline.AddMiddleware <PublishRaisedSubscriptionEventsMiddleware <TSchema> >( ServiceLifetime.Singleton); return(schemaBuilder); }
void UserLogin(ISchemaBuilder builder) { builder.TableBuilder.CreateTable(_userLogin); builder.ProcedureBuilder .CreateDefaultProcedures(_userLogin) .CreateProcedure(new SchemaProcedure("SelectUserLoginsPaged", StoredProcedureType.SelectPaged) .ForTable(_userLogin) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "LoginProvider", DbType = DbType.String, Length = "128" }, new SchemaColumn() { Name = "ProviderKey", DbType = DbType.String, Length = "128" } })); }
public static ISchemaBuilder RegisterQuerys(this ISchemaBuilder schemaBuilder) { schemaBuilder.AddQueryType <ObjectType <UserUseCase> >(); return(schemaBuilder); }
public void Map(ISchemaBuilder <CustomerRegistered> map) { map.Name("CustomerRegistered"); }
void UserRoles(ISchemaBuilder builder) { // create tables builder.TableBuilder.CreateTable(_userRoles); // Create procedures builder.ProcedureBuilder.CreateDefaultProcedures(_userRoles) // Overwrite our SelectUserRoleById created via CreateDefaultProcedures // above to also join and return all role data .CreateProcedure( new SchemaProcedure( $"SelectUserRoleById", @" SELECT ur.Id, ur.UserId, r.Id AS RoleId, r.[Name], r.NormalizedName, r.Description, r.Claims, r.CreatedDate, r.CreatedUserId, r.ModifiedDate, r.ModifiedUserId, r.ConcurrencyStamp FROM {prefix}_UserRoles ur WITH (nolock) INNER JOIN {prefix}_Roles r ON ur.RoleId = r.Id WHERE ( ur.Id = @Id )") .ForTable(_userRoles) .WithParameter(_userRoles.PrimaryKeyColumn)) .CreateProcedure( new SchemaProcedure("SelectRolesByUserId", @" SELECT * FROM {prefix}_Roles WITH (nolock) WHERE Id IN ( SELECT RoleId FROM {prefix}_UserRoles WITH (nolock) WHERE ( UserId = @UserId ) ) ") .WithParameter(new SchemaColumn() { Name = "UserId", DbType = DbType.Int32 })) .CreateProcedure( new SchemaProcedure("SelectUserRolesByUserId", StoredProcedureType.SelectByKey) .ForTable(_userRoles) .WithParameter(new SchemaColumn() { Name = "UserId", DbType = DbType.Int32 })) .CreateProcedure(new SchemaProcedure("SelectUserRolesPaged", StoredProcedureType.SelectPaged) .ForTable(_userRoles) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "Keywords", DbType = DbType.String, Length = "255" }, new SchemaColumn() { Name = "RoleName", DbType = DbType.String, Length = "255" } })) .CreateProcedure( new SchemaProcedure("DeleteUserRolesByUserId", StoredProcedureType.DeleteByKey) .ForTable(_userRoles) .WithParameter(new SchemaColumn() { Name = "UserId", DbType = DbType.Int32 })) .CreateProcedure( new SchemaProcedure("DeleteUserRoleByUserIdAndRoleId", StoredProcedureType.DeleteByKey) .ForTable(_userRoles) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "UserId", DbType = DbType.Int32 }, new SchemaColumn() { Name = "RoleId", DbType = DbType.Int32 } })); }
protected IRequestExecutor CreateSchema <TEntity, T>( TEntity[] entities, FilterConvention?convention = null, bool withPaging = false, Action <ISchemaBuilder>?configure = null, Action <ModelBuilder>?onModelCreating = null) where TEntity : class where T : FilterInputType <TEntity> { convention ??= new FilterConvention(x => x.AddDefaults().BindRuntimeType <TEntity, T>()); Func <IResolverContext, IEnumerable <TEntity> >?resolver = BuildResolver(onModelCreating, entities); ISchemaBuilder builder = SchemaBuilder.New() .AddConvention <IFilterConvention>(convention) .AddFiltering() .AddQueryType( c => { ApplyConfigurationToField <TEntity, T>( c.Name("Query").Field("root").Resolve(resolver), withPaging); ApplyConfigurationToField <TEntity, T>( c.Name("Query") .Field("rootExecutable") .Resolve( ctx => resolver(ctx).AsExecutable()), withPaging); }); configure?.Invoke(builder); ISchema schema = builder.Create(); return(new ServiceCollection() .Configure <RequestExecutorSetup>( Schema.DefaultName, o => o.Schema = schema) .AddGraphQL() .UseRequest( next => async context => { await next(context); if (context.Result is IReadOnlyQueryResult result && context.ContextData.TryGetValue("sql", out var queryString)) { context.Result = QueryResultBuilder .FromResult(result) .SetContextData("sql", queryString) .Create(); } }) .UseDefaultPipeline() .Services .BuildServiceProvider() .GetRequiredService <IRequestExecutorResolver>() .GetRequestExecutorAsync() .Result); }
public static ISchemaBuilder AddExportDirectiveType( this ISchemaBuilder builder) { return(builder.AddDirectiveType <ExportDirectiveType>()); }
public SetUpEventHandler( ISchemaBuilder schemaBuilder) { _schemaBuilder = schemaBuilder; }
void Users(ISchemaBuilder builder) { builder.TableBuilder.CreateTable(_users); builder.ProcedureBuilder.CreateDefaultProcedures(_users) // Overwrite our SelectEntityById created via CreateDefaultProcedures // above to also return all EntityData within a second result set .CreateProcedure( new SchemaProcedure( $"SelectUserById", @" /* user */ SELECT * FROM {prefix}_Users WITH (nolock) WHERE ( Id = @Id ) /* user data */ SELECT * FROM {prefix}_UserData WITH (nolock) WHERE ( UserId = @Id ) /* roles */ SELECT r.* FROM {prefix}_UserRoles ur WITH (nolock) INNER JOIN {prefix}_Roles r ON ur.RoleId = r.Id WHERE ( ur.UserId = @Id ) /* logins */ SELECT l.* FROM {prefix}_UserLogins l WITH (nolock) WHERE ( l.UserId = @Id )") .ForTable(_users) .WithParameter(_users.PrimaryKeyColumn)) .CreateProcedure(new SchemaProcedure("SelectUserByEmail", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( Email = @Email )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameter(new SchemaColumn() { Name = "Email", DbType = DbType.String, Length = "255" })) .CreateProcedure(new SchemaProcedure("SelectUserByEmailNormalized", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( NormalizedEmail = @NormalizedEmail )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameter( new SchemaColumn() { Name = "NormalizedEmail", DbType = DbType.String, Length = "255" })) .CreateProcedure(new SchemaProcedure("SelectUserByUserName", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( UserName = @UserName )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameter(new SchemaColumn() { Name = "UserName", DbType = DbType.String, Length = "255" })) .CreateProcedure( new SchemaProcedure("SelectUserByUserNameNormalized", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( NormalizedUserName = @NormalizedUserName )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameter(new SchemaColumn() { Name = "NormalizedUserName", DbType = DbType.String, Length = "255" })) .CreateProcedure(new SchemaProcedure("SelectUserByApiKey", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( ApiKey = @ApiKey )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameter(new SchemaColumn() { Name = "ApiKey", DbType = DbType.String, Length = "255" })) .CreateProcedure( new SchemaProcedure("SelectUserByEmailAndPassword", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( Email = @Email AND PasswordHash = @PasswordHash )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "Email", DbType = DbType.String, Length = "255" }, new SchemaColumn() { Name = "PasswordHash", DbType = DbType.String, Length = "255" } })) .CreateProcedure( new SchemaProcedure("SelectUserByResetToken", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( ResetToken = @ResetToken )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "ResetToken", DbType = DbType.String, Length = "255" } })) .CreateProcedure( new SchemaProcedure("SelectUserByConfirmationToken", @" DECLARE @Id int; SET @Id = (SELECT Id FROM {prefix}_Users WITH (nolock) WHERE ( ConfirmationToken = @ConfirmationToken )) EXEC {prefix}_SelectUserById @id;") .ForTable(_users) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "ConfirmationToken", DbType = DbType.String, Length = "255" } })) .CreateProcedure(new SchemaProcedure("SelectUsersPaged", StoredProcedureType.SelectPaged) .ForTable(_users) .WithParameters(new List <SchemaColumn>() { new SchemaColumn() { Name = "Keywords", DbType = DbType.String, Length = "255" }, new SchemaColumn() { Name = "RoleName", DbType = DbType.String, Length = "255" } })); // Indexes builder.IndexBuilder.CreateIndex(new SchemaIndex() { TableName = _users.Name, Columns = new string[] { "UserName", "NormalizedUserName", "Email", "NormalizedEmail", "UserType" } }); }
public override ISchemaBuilder AddGraphQlServices(ISchemaBuilder builder) { return(builder .AddQueryType <PermissionQueries>() .AddMutationType <PermissionMutations>()); }
public void SetUp() { schema_builder = new NhibernateSchemaBuilder(config); table = schema_builder.GetSchema().Tables.FirstOrDefault(x => x.TableName == "Employees"); }
public static void CreateDataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder) { string filePath; lock (DataServiceController.syncObject) { Configuration configuration = null; if (settings == null) { try { settings = DSConfiguration.GetSection(configuration); } catch (Exception exception1) { Exception exception = exception1; Microsoft.Management.Odata.Tracing.Tracer current = TraceHelper.Current; string str = "config file is "; if (configuration == null) { filePath = "(not available)"; } else { filePath = configuration.FilePath; } current.DebugMessage(string.Concat(str, filePath)); if (TraceHelper.IsEnabled(5)) { TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create")); } TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message); throw; } } DataServiceController.current = new DataServiceController(settings, customContextStore, testSchemaBuilder); } }
/// <summary> /// Adds Sorting support. /// </summary> /// <param name="builder"> /// The <see cref="ISchemaBuilder"/>. /// </param> /// <returns> /// Returns the <see cref="ISchemaBuilder"/>. /// </returns> public static ISchemaBuilder AddSorting(this ISchemaBuilder builder) => AddSorting(builder, x => x.AddDefaults());
public OrderEventUnionSchemaBuilderCase(ISchemaBuilder schemaBuilder) { this.schemaBuilder = schemaBuilder; }
public static IServiceCollection AddGraphQLSchema( this IServiceCollection services, ISchemaBuilder builder) { return(services.AddGraphQLSchema(string.Empty, builder)); }
public override ISchemaBuilder AddGraphQlServices(ISchemaBuilder builder) { return(builder .AddQueryType <WebsocketQueries>()); }
public override ISchemaBuilder AddGraphQlServices(ISchemaBuilder builder) { return(builder .AddQueryType <PaymentWebhookQueries>()); }
public static ISchemaBuilder AddDirectiveType( this ISchemaBuilder builder, string name, DirectiveLocation location) => AddDirectiveType(builder, name, location, x => x);
public Schema(ISchemaBuilder schemaObjectBuilder) { TableName = schemaObjectBuilder.GetTableName(); Name = schemaObjectBuilder.GetName(); Columns = schemaObjectBuilder.GetColumnCollectionSchema(); }