last ...
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using xServices.Models.Entities;
|
|
||||||
|
|
||||||
namespace xServices.Configurations
|
|
||||||
{
|
|
||||||
public class XTestConfiguration : IEntityTypeConfiguration<XTest>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<XTest> builder)
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Configurations
|
||||||
|
{
|
||||||
|
public class XTestTypeConfiguration : XBaseEntityTypeConfiguration<XTest, Guid>
|
||||||
|
{
|
||||||
|
public override void Configure(EntityTypeBuilder<XTest> builder)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xDataService.DI;
|
||||||
|
using xDataService.Models;
|
||||||
using xMessageService.DI;
|
using xMessageService.DI;
|
||||||
using xServices.Configurations;
|
using xServices.Configurations;
|
||||||
using xServices.Constants;
|
using xServices.Constants;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Providers;
|
||||||
using xStorageService.DI;
|
using xStorageService.DI;
|
||||||
|
|
||||||
namespace xServices.DI
|
namespace xServices.DI
|
||||||
@@ -48,7 +54,7 @@ namespace xServices.DI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
services.AddSingleton<XServicesConfiguration>(config);
|
services.AddSingleton(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -68,18 +74,21 @@ namespace xServices.DI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
services.AddSingleton<XServicesConfiguration>(configuration);
|
services.AddSingleton(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register Services ...
|
/// Register Services ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services"></param>
|
/// <param name="services"></param>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
|
/// <param name="databases"></param>
|
||||||
/// <param name="lifeTime"></param>
|
/// <param name="lifeTime"></param>
|
||||||
public static void AddXServices(
|
public static void AddXServices(
|
||||||
this IServiceCollection services,
|
this IServiceCollection services,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
ServiceLifetime lifeTime = ServiceLifetime.Transient
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
||||||
|
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -90,6 +99,7 @@ namespace xServices.DI
|
|||||||
config: config,
|
config: config,
|
||||||
services: services,
|
services: services,
|
||||||
lifeTime: lifeTime,
|
lifeTime: lifeTime,
|
||||||
|
databases: databases,
|
||||||
configuration: configuration
|
configuration: configuration
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -99,12 +109,15 @@ namespace xServices.DI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services"></param>
|
/// <param name="services"></param>
|
||||||
/// <param name="configuration"></param>
|
/// <param name="configuration"></param>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="databases"></param>
|
||||||
/// <param name="lifeTime"></param>
|
/// <param name="lifeTime"></param>
|
||||||
public static void AddXServices(
|
public static void AddXServices(
|
||||||
this IServiceCollection services,
|
this IServiceCollection services,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
XServicesConfiguration config,
|
XServicesConfiguration config,
|
||||||
ServiceLifetime lifeTime = ServiceLifetime.Transient
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
||||||
|
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -112,6 +125,7 @@ namespace xServices.DI
|
|||||||
config: config,
|
config: config,
|
||||||
services: services,
|
services: services,
|
||||||
lifeTime: lifeTime,
|
lifeTime: lifeTime,
|
||||||
|
databases: databases,
|
||||||
configuration: configuration
|
configuration: configuration
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -120,11 +134,35 @@ namespace xServices.DI
|
|||||||
/// Use All Required Middlewares ...
|
/// Use All Required Middlewares ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="app"></param>
|
/// <param name="app"></param>
|
||||||
public static void UseXServices(this IApplicationBuilder app)
|
/// <param name="databases"></param>
|
||||||
|
/// <param name="isDevelopmentEnvironment"></param>
|
||||||
|
public static void UseXServices(
|
||||||
|
this IApplicationBuilder app,
|
||||||
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
||||||
|
bool isDevelopmentEnvironment = false
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Use Storage Service ...
|
// Use Storage Service ...
|
||||||
app.UseXStorageService();
|
app.UseXStorageService();
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Use Data Data Service ...
|
||||||
|
if (databases.HasChild())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
databases
|
||||||
|
.ToList()
|
||||||
|
.ForEach(database =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
app.UseXDatabase(
|
||||||
|
descriptor: database,
|
||||||
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -134,11 +172,14 @@ namespace xServices.DI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services"></param>
|
/// <param name="services"></param>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
|
/// <param name="databases"></param>
|
||||||
/// <param name="lifeTime"></param>
|
/// <param name="lifeTime"></param>
|
||||||
private static void AddServices(
|
private static void AddServices(
|
||||||
this IServiceCollection services,
|
this IServiceCollection services,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
XServicesConfiguration config = null,
|
XServicesConfiguration config = null,
|
||||||
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
||||||
ServiceLifetime lifeTime = ServiceLifetime.Transient
|
ServiceLifetime lifeTime = ServiceLifetime.Transient
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -156,6 +197,31 @@ namespace xServices.DI
|
|||||||
//
|
//
|
||||||
// Message Service ...
|
// Message Service ...
|
||||||
services.AddXMessageService(config: configuration);
|
services.AddXMessageService(config: configuration);
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Register Data Service ...
|
||||||
|
//
|
||||||
|
if (databases.HasChild())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
databases
|
||||||
|
.ToList()
|
||||||
|
.ForEach(database =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Register DataBase ...
|
||||||
|
services.AddXDatabase(
|
||||||
|
lifetime: lifeTime,
|
||||||
|
descriptor: database,
|
||||||
|
configuration: configuration
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Repository Services ...
|
||||||
|
services.AddScoped<IXTestRepositoryService, XTestRepositoryService>();
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using xDataService.Interfaces;
|
||||||
|
using xServices.Models.Dtos;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Interfaces
|
||||||
|
{
|
||||||
|
public interface IXTestRepositoryService : IXBaseRepositoryService<XTest, XTestDto, Guid>
|
||||||
|
{ }
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.EFRepositories;
|
using xDataService.Providers;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xServices.Databases;
|
using xServices.Databases;
|
||||||
using xServices.Interfaces;
|
using xServices.Interfaces;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ namespace xServices.Providers
|
|||||||
{
|
{
|
||||||
public class XTestGraphQLTypeHelper : XBaseGraphQLTypeHelper<XTest, Guid>, IXTestGraphQLTypeHelper
|
public class XTestGraphQLTypeHelper : XBaseGraphQLTypeHelper<XTest, Guid>, IXTestGraphQLTypeHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
public XTestGraphQLTypeHelper(
|
public XTestGraphQLTypeHelper(
|
||||||
XDataServiceConfiguration configuration
|
XDataServiceConfiguration configuration
|
||||||
) : base(configuration)
|
) : base(configuration)
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using xDataService.Configuration;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Providers
|
||||||
|
{
|
||||||
|
public class XTestInMemoryRepository : XBaseInMemoryRepository<XTest, Guid>
|
||||||
|
{
|
||||||
|
public XTestInMemoryRepository(
|
||||||
|
XDataServiceConfiguration configuration,
|
||||||
|
IXTestKeyGenerator keyGenerator = null,
|
||||||
|
IXTestRepositoryEvents baseRepositoryEvents = null
|
||||||
|
) : base(
|
||||||
|
configuration,
|
||||||
|
keyGenerator,
|
||||||
|
baseRepositoryEvents
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using xDataService.Configuration;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Providers
|
||||||
|
{
|
||||||
|
public class XTestMongoRepository : XBaseMongoRepository<XTest, Guid>
|
||||||
|
{
|
||||||
|
public XTestMongoRepository(
|
||||||
|
XDataBaseConfiguration dbConfiguration,
|
||||||
|
XDataServiceConfiguration configuration,
|
||||||
|
string collectionName = null,
|
||||||
|
IXTestKeyGenerator keyGenerator = null,
|
||||||
|
IXTestRepositoryEvents baseRepositoryEvents = null
|
||||||
|
) : base(
|
||||||
|
dbConfiguration,
|
||||||
|
configuration,
|
||||||
|
collectionName,
|
||||||
|
keyGenerator,
|
||||||
|
baseRepositoryEvents
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using xCommons.Configurations;
|
||||||
|
using xCommons.Providers;
|
||||||
|
using xDataService.Controllers;
|
||||||
|
using xDataService.Interfaces;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Providers
|
||||||
|
{
|
||||||
|
public partial class XTestRepositoryController : XBaseRepositoryController<XTest, Guid>, IXBaseRepositoryController<XTest, Guid>
|
||||||
|
{
|
||||||
|
public XTestRepositoryController(
|
||||||
|
ILogger<XTestRepositoryController> logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
XValidationProvider validationProvider,
|
||||||
|
IXTestRepository repository,
|
||||||
|
Func<IQueryable<XTest>, IOrderedQueryable<XTest>> defaultOrderBuilder = null,
|
||||||
|
Func<IQueryable<XTest>, IIncludableQueryable<XTest, object>> defaultIncludeBuilder = null
|
||||||
|
) : base(
|
||||||
|
logger,
|
||||||
|
appConfiguration,
|
||||||
|
validationProvider,
|
||||||
|
repository,
|
||||||
|
defaultOrderBuilder,
|
||||||
|
defaultIncludeBuilder
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using xDataService.Events;
|
using xDataService.Providers;
|
||||||
using xServices.Interfaces;
|
using xServices.Interfaces;
|
||||||
using xServices.Models.Entities;
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Models.Dtos;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Providers
|
||||||
|
{
|
||||||
|
public class XTestRepositoryService : XBaseRepositoryService<XTest, XTestDto, Guid>, IXTestRepositoryService
|
||||||
|
{
|
||||||
|
public XTestRepositoryService(
|
||||||
|
IXTestRepository repository,
|
||||||
|
IEnumerable<Profile> mapperProfiles = null
|
||||||
|
) : base(repository, mapperProfiles)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using xCommons.Configurations;
|
||||||
|
using xCommons.Providers;
|
||||||
|
using xDataService.Controllers;
|
||||||
|
using xDataService.Interfaces;
|
||||||
|
using xServices.Interfaces;
|
||||||
|
using xServices.Models.Dtos;
|
||||||
|
using xServices.Models.Entities;
|
||||||
|
|
||||||
|
namespace xServices.Providers
|
||||||
|
{
|
||||||
|
public class XTestServiceController : XBaseServiceController<XTest, XTestDto, Guid>, IXBaseServiceController<XTest, XTestDto, Guid>
|
||||||
|
{
|
||||||
|
public XTestServiceController(
|
||||||
|
ILogger<XTestServiceController> logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
XValidationProvider validationProvider,
|
||||||
|
IXTestRepositoryService repositoryService,
|
||||||
|
Func<IQueryable<XTest>, IOrderedQueryable<XTest>> defaultOrderBuilder = null,
|
||||||
|
Func<IQueryable<XTest>, IIncludableQueryable<XTest, object>> defaultIncludeBuilder = null
|
||||||
|
) : base(
|
||||||
|
logger,
|
||||||
|
appConfiguration,
|
||||||
|
validationProvider,
|
||||||
|
repositoryService,
|
||||||
|
defaultOrderBuilder,
|
||||||
|
defaultIncludeBuilder
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user