last ...
This commit is contained in:
+10
-99
@@ -34,11 +34,15 @@ namespace xApi
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
//
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
private readonly XApiDatabaseDescriptor apiDatabaseDescriptor;
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
|
apiDatabaseDescriptor = new XApiDatabaseDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
@@ -110,110 +114,17 @@ namespace xApi
|
|||||||
x.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
x.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Check Data Service ...
|
// // Check Data Service ...
|
||||||
var dataServiceConfig = Configuration.GetXDataServiceConfiguration();
|
// var dataServiceConfig = Configuration.GetXDataServiceConfiguration();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check DataBase Registration ...
|
// Check DataBase Registration ...
|
||||||
services.AddXDatabase(
|
services.AddXDatabase(
|
||||||
|
lifetime: lifeTime,
|
||||||
configuration: Configuration,
|
configuration: Configuration,
|
||||||
descriptor: new XApiDatabaseDescriptor(),
|
descriptor: apiDatabaseDescriptor
|
||||||
lifetime: ServiceLifetime.Scoped
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register XPushService ...
|
|
||||||
// services.AddXPushService(Configuration);
|
|
||||||
// services.AddXPushHubProvider(lifeTime);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register XIdentityService ...
|
|
||||||
// services.AddXIdentityService(Configuration, lifeTime);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register DataService here ...
|
|
||||||
// #region Register xDataService ...
|
|
||||||
// //
|
|
||||||
// // Register IXDataServiceHelper ...
|
|
||||||
// services.AddSingleton<IXDataServiceHelper, XDataHelperDataProviderHelper>();
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Prepare Db Options Builder based on Provider ...
|
|
||||||
// var providerType = Configuration.GetXDbProviderType();
|
|
||||||
// switch (providerType)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// case XDbProviders.MySQL:
|
|
||||||
// case XDbProviders.SQLite:
|
|
||||||
// case XDbProviders.SQLServer:
|
|
||||||
// Action<dynamic> optionsBuilder = optionsBuilder = b =>
|
|
||||||
// {
|
|
||||||
// b.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register xDataService on DI ...
|
|
||||||
// services.AddXDataService<XDataHelperDbContext, XDataHelperDbSeeder>(
|
|
||||||
// Configuration,
|
|
||||||
// lifeTime,
|
|
||||||
// XDbProviderConfigurations.DEFAULT_CONNECTION_NAME,
|
|
||||||
// optionsBuilder
|
|
||||||
// );
|
|
||||||
// break;
|
|
||||||
|
|
||||||
// //
|
|
||||||
// case XDbProviders.MongoDB:
|
|
||||||
// //
|
|
||||||
// // Register xDataService on DI ...
|
|
||||||
// services.AddXDataService<XDataHelperDbSeeder>(
|
|
||||||
// Configuration,
|
|
||||||
// lifeTime,
|
|
||||||
// XDbProviderConfigurations.DEFAULT_CONNECTION_NAME
|
|
||||||
// );
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register GraphQL here ...
|
|
||||||
// #region Register xGraphQL ...
|
|
||||||
// //
|
|
||||||
// services.Configure<IISServerOptions>(options =>
|
|
||||||
// {
|
|
||||||
// options.AllowSynchronousIO = true;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// //
|
|
||||||
// services.Configure<KestrelServerOptions>(options =>
|
|
||||||
// {
|
|
||||||
// options.AllowSynchronousIO = true;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register XGraphQL Helper ...
|
|
||||||
// services.AddSingleton<IXGraphQLHelper, XDataHelperGraphQLHelper>();
|
|
||||||
|
|
||||||
// //
|
|
||||||
// services.AddXGraphQL(options =>
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// options.EnableMetrics = true;
|
|
||||||
// options.UnhandledExceptionDelegate = context =>
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("XGraphQL Error: " + context.OriginalException.Message);
|
|
||||||
// };
|
|
||||||
// });
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Register Services Module Providers here ...
|
|
||||||
// #region Register xServices ...
|
|
||||||
// services.AddXServices(
|
|
||||||
// lifeTime: lifeTime,
|
|
||||||
// configuration: Configuration
|
|
||||||
// );
|
|
||||||
// #endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
@@ -265,7 +176,7 @@ namespace xApi
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Use xDataService Middleware ...
|
// Use xDataService Middleware ...
|
||||||
// app.UseXDataService();
|
app.UseXDatabase(apiDatabaseDescriptor);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Using Services ...
|
// Using Services ...
|
||||||
|
|||||||
Reference in New Issue
Block a user