1456 lines
43 KiB
Plaintext
1456 lines
43 KiB
Plaintext
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Base\IXBaseService.cs
|
|
|
|
namespace xServices.Base
|
|
{
|
|
public interface IXBaseService
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Base\XBaseService.cs
|
|
|
|
namespace xServices.Base
|
|
{
|
|
public class XBaseService : IXBaseService
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Base\XTestProviderControllerBase.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
using xPushService.Controllers;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Base
|
|
{
|
|
/// <summary>
|
|
/// an Abstract Implementation of Provided Actions for XTest ...
|
|
/// </summary>
|
|
public abstract class XTestProviderControllerBase : XBaseProvidedController<XTest, XTestDto, Guid, XTestDtoHub>, IXTestProviderController
|
|
{
|
|
protected XTestProviderControllerBase(
|
|
ILogger<XTestProviderControllerBase> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXTestProvider provider,
|
|
Func<IQueryable<XTest>, IOrderedQueryable<XTest>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XTest>, IIncludableQueryable<XTest, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Configurations\XServicesConfiguration.cs
|
|
|
|
namespace xServices.Configurations
|
|
{
|
|
public partial class XServicesConfiguration
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Configurations\XTestTypeConfiguration.cs
|
|
|
|
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)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Constants\ConfigurationNodeNames.cs
|
|
|
|
namespace xServices.Constants
|
|
{
|
|
public partial struct ConfigurationNodeNames
|
|
{
|
|
public const string SERVICES_NODE = "ServicesConfiguration";
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Constants\xServicesConstancts.cs
|
|
|
|
using xExceptions.Attributes;
|
|
|
|
namespace xServices.Constants
|
|
{
|
|
public class xServicesConstancts
|
|
{
|
|
}
|
|
|
|
public enum XQueryServiceEndPoints
|
|
{
|
|
/// <summary>
|
|
/// Specified Endpoint for Users Fetching as Query ...
|
|
/// </summary>
|
|
[StringValue("Account/Users/Query")]
|
|
QueryUsers,
|
|
|
|
/// <summary>
|
|
/// Refresh Tokens ...
|
|
/// </summary>
|
|
[StringValue("Account/RefreshTokens")]
|
|
RefreshTokens,
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XCategoryProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCategoryService.Controllers;
|
|
using xCategoryService.Interfaces;
|
|
using xCategoryService.Models.Entities;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XCategoryProviderController : XCategoryProviderControllerBase, IXCategoryProviderController
|
|
{
|
|
public XCategoryProviderController(
|
|
ILogger<XCategoryProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXCategoryProvider provider,
|
|
Func<IQueryable<XCategory>, IOrderedQueryable<XCategory>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XCategory>, IIncludableQueryable<XCategory, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XFileProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xFileService.Controllers;
|
|
using xFileService.Interfaces;
|
|
using xFileService.Models.Entities;
|
|
using xIdentityService.Interfaces;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XFileProviderController : XFileProviderControllerBase, IXFileProviderController
|
|
{
|
|
public XFileProviderController(
|
|
ILogger<XFileProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXFileProvider provider,
|
|
IXFileTagProvided tagProvided,
|
|
Func<IQueryable<XFile>, IOrderedQueryable<XFile>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XFile>, IIncludableQueryable<XFile, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
tagProvided,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XStringProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
using xStringService.Controllers;
|
|
using xStringService.Interfaces;
|
|
using xStringService.Models.Entities;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XStringProviderController : XStringProviderControllerBase, IXStringProviderController
|
|
{
|
|
public XStringProviderController(
|
|
ILogger<XStringProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXStringProvider provider,
|
|
Func<IQueryable<XString>, IOrderedQueryable<XString>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XString>, IIncludableQueryable<XString, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XSubCategoryProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCategoryService.Controllers;
|
|
using xCategoryService.Interfaces;
|
|
using xCategoryService.Models.Entities;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XSubCategoryProviderController : XSubCategoryProviderControllerBase, IXSubCategoryProviderController
|
|
{
|
|
public XSubCategoryProviderController(
|
|
ILogger<XSubCategoryProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXSubCategoryProvider provider,
|
|
Func<IQueryable<XSubCategory>, IOrderedQueryable<XSubCategory>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XSubCategory>, IIncludableQueryable<XSubCategory, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XTagProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
using xTagService.Controllers;
|
|
using xTagService.Interfaces;
|
|
using xTagService.Models.Entities;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XTagProviderController : XTagProviderControllerBase, IXTagProviderController
|
|
{
|
|
public XTagProviderController(
|
|
ILogger<XTagProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXTagProvider provider,
|
|
Func<IQueryable<XTag>, IOrderedQueryable<XTag>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XTag>, IIncludableQueryable<XTag, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XTermsAndConditionsProviderController.cs
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
using xTermsAndConditionsService.Controllers;
|
|
using xTermsAndConditionsService.Interfaces;
|
|
using xTermsAndConditionsService.Providers;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XTermsAndConditionsProviderController : XTermsAndConditionsControllerBase, IXTermsAndConditionsController
|
|
{
|
|
public XTermsAndConditionsProviderController(
|
|
ILogger<XTermsAndConditionsProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXTermsAndConditionsProvider provider
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Controllers\XTestProviderController.cs
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.Extensions.Logging;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Interfaces;
|
|
using xServices.Base;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Controllers
|
|
{
|
|
public class XTestProviderController : XTestProviderControllerBase, IXTestProviderController
|
|
{
|
|
public XTestProviderController(
|
|
ILogger<XTestProviderController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
XValidationProvider validationProvider,
|
|
IXTestProvider provider,
|
|
Func<IQueryable<XTest>, IOrderedQueryable<XTest>> defaultOrderBuilder = null,
|
|
Func<IQueryable<XTest>, IIncludableQueryable<XTest, object>> defaultIncludeBuilder = null
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
identityProvider,
|
|
validationProvider,
|
|
provider,
|
|
defaultOrderBuilder,
|
|
defaultIncludeBuilder
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Databases\XApiDatabaseDescriptor.cs
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using GraphQL.Types;
|
|
using xDataService.Interfaces;
|
|
using xDataService.Models;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
using xServices.Models.GraphQL;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Databases
|
|
{
|
|
public class XApiDatabaseDescriptor : XDatabaseDescriptor<XApiDbContext>, IXDatabaseDescriptor<XApiDbContext>
|
|
{
|
|
public XApiDatabaseDescriptor() : base(
|
|
name: "xApiDb",
|
|
repositories: new List<XRepositoryDescriptor>
|
|
{
|
|
//
|
|
// XTest Entity ...
|
|
new XEFRepositoryDescriptor<
|
|
XTest,
|
|
Guid,
|
|
IXTestKeyGenerator,
|
|
XTestKeyGenerator,
|
|
IXTestRepositoryEvents,
|
|
XTestRepositoryEvents,
|
|
XTestGraphType,
|
|
GuidGraphType,
|
|
XTestGraphQuery,
|
|
IXTestGraphQLTypeHelper,
|
|
XTestGraphQLTypeHelper,
|
|
XTestGraphSchema,
|
|
IXTestRepository,
|
|
XTestEFRepository,
|
|
XApiDbContext,
|
|
IXTestSeeder,
|
|
XTestSeeder
|
|
>
|
|
{}
|
|
}
|
|
)
|
|
{
|
|
OptionsBuilder = b => b.MigrationsAssembly("xApi");
|
|
}
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Databases\XApiDbContext.cs
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
using xCategoryService.Providers;
|
|
using xDataService.Configuration;
|
|
using xDataService.Db;
|
|
using xDataService.Providers;
|
|
using xFileService.Providers;
|
|
using xServices.Models.Entities;
|
|
using xStringService.Providers;
|
|
using xTagService.Providers;
|
|
using xWebinarService.Providers;
|
|
// using xStringService.Models.Entities;
|
|
|
|
namespace xServices.Databases
|
|
{
|
|
public class XApiDbContext : XDbContext
|
|
{
|
|
//
|
|
#region DbSets ...
|
|
public DbSet<XTest> Tests { get; set; }
|
|
#endregion
|
|
|
|
//
|
|
#region Navigation Property Entities ...
|
|
#endregion
|
|
|
|
public XApiDbContext(
|
|
DbContextOptions options,
|
|
XDataServiceConfiguration config,
|
|
XEntityRegisterarHandlerService dynamicEntityHandlers
|
|
) : base(
|
|
"xApiDb",
|
|
options,
|
|
config,
|
|
dynamicEntityHandlers,
|
|
new string[] {
|
|
nameof(XTagEntityRegisterar),
|
|
nameof(XFileEntityRegisterar),
|
|
nameof(XStringEntityRegisterar),
|
|
nameof(XWebinarEntityRegisterar),
|
|
nameof(XCategoryEntityRegisterar),
|
|
nameof(XSubCategoryEntityRegisterar),
|
|
nameof(XWebinarSubscriberEntityRegisterar),
|
|
}
|
|
)
|
|
{ }
|
|
|
|
//
|
|
public override void OnXModelCreating(ModelBuilder modelBuilder)
|
|
{ }
|
|
|
|
//
|
|
public override void OnXConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\DI\XDIHelperExtension.cs
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using xCategoryService.DI;
|
|
using xCommons.Extensions;
|
|
using xDataService.DI;
|
|
using xDataService.Models;
|
|
using xFileService.DI;
|
|
using xIdentityService.DI;
|
|
using xMessageService.DI;
|
|
using xPushService.DI;
|
|
using xPushService.Helpers;
|
|
using xServices.Configurations;
|
|
using xServices.Constants;
|
|
using xServices.Databases;
|
|
using xServices.Interfaces;
|
|
using xServices.Providers;
|
|
using xStorageService.DI;
|
|
using xStringService.DI;
|
|
using xTagService.DI;
|
|
using xTermsAndConditionsService.DI;
|
|
using xWebinarService.DI;
|
|
|
|
namespace xServices.DI
|
|
{
|
|
public static partial class XDIHelperExtension
|
|
{
|
|
/// <summary>
|
|
/// Retrive Services Configurations ...
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <returns></returns>
|
|
public static XServicesConfiguration GetXServicesConfiguration(
|
|
this IConfiguration source
|
|
)
|
|
{
|
|
//
|
|
var xConfig = source
|
|
.GetSection(ConfigurationNodeNames.SERVICES_NODE);
|
|
var result = xConfig.Get<XServicesConfiguration>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register Service Configuration ...
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <param name="configuration"></param>
|
|
public static void AddXServicesConfiguration(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration
|
|
)
|
|
{
|
|
//
|
|
var config = configuration
|
|
.GetXServicesConfiguration();
|
|
if (config.IsNull())
|
|
{
|
|
config = new XServicesConfiguration();
|
|
}
|
|
|
|
//
|
|
services.AddSingleton(config);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register Service Configuration ...
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <param name="configuration"></param>
|
|
public static void AddXServicesConfiguration(
|
|
this IServiceCollection services,
|
|
XServicesConfiguration configuration
|
|
)
|
|
{
|
|
//
|
|
if (configuration.IsNull())
|
|
{
|
|
configuration = new XServicesConfiguration();
|
|
}
|
|
|
|
//
|
|
services.AddSingleton(configuration);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register Services ...
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <param name="configuration"></param>
|
|
/// <param name="databases"></param>
|
|
/// <param name="lifeTime"></param>
|
|
public static void AddXServices(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration,
|
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
|
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
|
)
|
|
{
|
|
//
|
|
var config = configuration.GetXServicesConfiguration();
|
|
|
|
//
|
|
AddServices(
|
|
config: config,
|
|
services: services,
|
|
lifeTime: lifeTime,
|
|
databases: databases,
|
|
configuration: configuration
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register Services ...
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <param name="configuration"></param>
|
|
/// <param name="config"></param>
|
|
/// <param name="databases"></param>
|
|
/// <param name="lifeTime"></param>
|
|
public static void AddXServices(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration,
|
|
XServicesConfiguration config,
|
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
|
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
|
)
|
|
{
|
|
//
|
|
AddServices(
|
|
config: config,
|
|
services: services,
|
|
lifeTime: lifeTime,
|
|
databases: databases,
|
|
configuration: configuration
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Use All Required Middlewares ...
|
|
/// </summary>
|
|
/// <param name="app"></param>
|
|
/// <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 ...
|
|
app.UseXStorageService();
|
|
|
|
//
|
|
#region Use Data Data Service ...
|
|
if (databases.HasChild())
|
|
{
|
|
//
|
|
databases
|
|
.ToList()
|
|
.ForEach(database =>
|
|
{
|
|
//
|
|
app.UseXDatabase(
|
|
descriptor: database,
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Use Hubs ...
|
|
//
|
|
var pushHelper = new XPushServiceHelper();
|
|
|
|
//
|
|
pushHelper.AddHub<XTestDtoHub>("testDto");
|
|
pushHelper.AddHub<XTestEntityHub>("testEntity");
|
|
|
|
//
|
|
app.UseXPushService(pushHelper);
|
|
#endregion
|
|
|
|
//
|
|
// Using String Service ...
|
|
app.UseXStringService(
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
|
|
//
|
|
// Using Terms and Conditions Service ...
|
|
app.UseXTermsAndConditionsService();
|
|
|
|
//
|
|
// Using Tag Service ...
|
|
app.UseXTagService(
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
|
|
//
|
|
// Using File Service ...
|
|
app.UseXFileService(
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
|
|
//
|
|
// Using Category Service ...
|
|
app.UseXCategoryService(
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
|
|
//
|
|
// Using XWebinar Service ...
|
|
app.UsexWebinarService(
|
|
isDevelopmentEnvironment: isDevelopmentEnvironment
|
|
);
|
|
}
|
|
|
|
//
|
|
#region Private ...
|
|
/// <summary>
|
|
/// Register Required Services ...
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <param name="config"></param>
|
|
/// <param name="configuration"></param>
|
|
/// <param name="databases"></param>
|
|
/// <param name="lifeTime"></param>
|
|
private static void AddServices(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration,
|
|
XServicesConfiguration config = null,
|
|
IEnumerable<XDatabaseDescriptor> databases = null,
|
|
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
|
)
|
|
{
|
|
//
|
|
// Check config ...
|
|
if (config.IsNull())
|
|
{
|
|
config = new XServicesConfiguration();
|
|
}
|
|
|
|
//
|
|
// Storage Service ...
|
|
services.AddXStorageService(configuration);
|
|
|
|
//
|
|
// Message Service ...
|
|
services.AddXMessageService(config: configuration);
|
|
|
|
//
|
|
#region Register Identity Service ...
|
|
services.AddXIdentityService(
|
|
configuration: configuration,
|
|
lifeTime: ServiceLifetime.Scoped
|
|
);
|
|
#endregion
|
|
|
|
//
|
|
#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<IXTestProvider, XTestProvider>();
|
|
services.AddScoped<IXTestRepositoryService, XTestRepositoryService>();
|
|
#endregion
|
|
|
|
//
|
|
#region Register Push Service ...
|
|
//
|
|
// Push Service ...
|
|
services.AddXPushService(
|
|
config: configuration,
|
|
lifeTime: ServiceLifetime.Scoped
|
|
);
|
|
|
|
//
|
|
// Register Provider Services ...
|
|
// since Hubs required Identity Provider, you Have to Register IdentityService as Requirements ...
|
|
// a Provider Service, Provides Repository (Entity) or Service (Dto) based
|
|
// Data Manipulation Actions by Supporting Hub Contexts Events ...
|
|
services.AddScoped<IXTestServiceProvider, XTestServiceProvider>();
|
|
services.AddScoped<IXTestRepositoryProvider, XTestRepositoryProvider>();
|
|
#endregion
|
|
|
|
//
|
|
var repositoryType = xDataService.Constants.XRepositoryType.EF;
|
|
|
|
//
|
|
// Register String Service ...
|
|
services.AddXStringService<XApiDbContext>(
|
|
lifeTime: lifeTime,
|
|
repositoryType: repositoryType
|
|
);
|
|
|
|
//
|
|
// Register Terms and Conditions Service ...
|
|
services.AddXTermsConditionsService(
|
|
lifeTime: lifeTime,
|
|
configuration: configuration
|
|
);
|
|
|
|
//
|
|
// Register Tag Service ...
|
|
services.AddXTagService<XApiDbContext>(
|
|
lifeTime: lifeTime,
|
|
repositoryType: repositoryType
|
|
);
|
|
|
|
//
|
|
// Register File Service ...
|
|
services.AddXFileService<XApiDbContext>(
|
|
lifeTime: lifeTime,
|
|
repositoryType: repositoryType
|
|
);
|
|
|
|
//
|
|
// Register Category Service ...
|
|
services.AddXCategoryServiceConfiguration(configuration);
|
|
services.AddXCategoryService<XApiDbContext>(
|
|
lifeTime: lifeTime,
|
|
repositoryType: repositoryType
|
|
);
|
|
|
|
//
|
|
// Register Webinar Service ...
|
|
services.AddXWebinarService<XApiDbContext>(
|
|
lifeTime: lifeTime,
|
|
repositoryType: repositoryType
|
|
);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Extensions\xServicesExtensions.cs
|
|
|
|
namespace xServices.Extensions
|
|
{
|
|
public static class xServicesExtensions
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestDtoHub.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestDtoHub : IXBaseDtoHub<XTest, XTestDto, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestEntityHub.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestEntityHub : IXBaseEntityHub<XTest, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestGraphQLTypeHelper.cs
|
|
|
|
using System;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XTest, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestGraphQuery.cs
|
|
|
|
using System;
|
|
using GraphQL.Types;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
using xServices.Models.GraphQL;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestGraphQuery : IXBaseGraphQLQuery<XTest, Guid, XTestGraphType, GuidGraphType>
|
|
{}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestKeyGenerator.cs
|
|
|
|
using System;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestKeyGenerator : IXKeyGenerator<XTest, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestProvider.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestProvider : IXBaseProvided<XTest, XTestDto, Guid, XTestDtoHub>
|
|
{}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestProviderController.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestProviderController : IXBaseProvidedController<XTest, XTestDto, Guid, XTestDtoHub>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestRepository.cs
|
|
|
|
using System;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestRepository : IXBaseRepository<XTest, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestRepositoryEvents.cs
|
|
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestRepositoryEvents : IXBaseRepositoryEvents<XTest>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestRepositoryProvider.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestRepositoryProvider : IXBaseEntityProvider<XTest, Guid, XTestEntityHub>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestRepositoryService.cs
|
|
|
|
using System;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestRepositoryService : IXBaseRepositoryService<XTest, XTestDto, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestSeeder.cs
|
|
|
|
using System;
|
|
using xDataService.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestSeeder : IXBaseDbSeeder<XTest, Guid>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Interfaces\IXTestServiceProvider.cs
|
|
|
|
using System;
|
|
using xPushService.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
using xServices.Providers;
|
|
|
|
namespace xServices.Interfaces
|
|
{
|
|
public interface IXTestServiceProvider : IXBaseDtoProvider<XTest, XTestDto, Guid, XTestDtoHub>
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Models\XGroupedData.cs
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using xModels.Base;
|
|
|
|
namespace xServices.Models
|
|
{
|
|
public class XGroupedDataEntity<T, TKey, TGroupedKey>
|
|
where T : XBaseEntity<TKey>
|
|
{
|
|
public TGroupedKey GroupedBy { set; get; }
|
|
public IEnumerable<T> Members { set; get; }
|
|
public DateTime TimeStamp { set; get; }
|
|
}
|
|
|
|
public class XGroupedDataDto<T, TGroupedKey>
|
|
where T : XBaseDto
|
|
{
|
|
public TGroupedKey GroupedBy { set; get; }
|
|
public IEnumerable<T> Members { set; get; }
|
|
public DateTime TimeStamp { set; get; }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Models\Dtos\XTestDto.cs
|
|
|
|
using System;
|
|
using xModels.Base;
|
|
|
|
namespace xServices.Models.Dtos
|
|
{
|
|
public class XTestDto : XBaseEntityDto<Guid>
|
|
{
|
|
public string Firstname { get; set; }
|
|
public string Lastname { get; set; }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Models\Entities\XTest.cs
|
|
|
|
using System;
|
|
using xModels.Base;
|
|
|
|
namespace xServices.Models.Entities
|
|
{
|
|
public class XTest : XBaseEntity<Guid>
|
|
{
|
|
public string Firstname { get; set; }
|
|
public string Lastname { get; set; }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Models\GraphQL\XTestGraphType.cs
|
|
|
|
using System;
|
|
using xDataService.GraphQL;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Models.GraphQL
|
|
{
|
|
public class XTestGraphType : XBaseGraphObjectType<XTest, Guid>
|
|
{
|
|
public XTestGraphType() : base()
|
|
{
|
|
Field(x => x.Firstname);
|
|
Field(x => x.Lastname);
|
|
}
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestDtoHub.cs
|
|
|
|
using System;
|
|
using Microsoft.Extensions.Logging;
|
|
using xPushService.Base;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestDtoHub : XBaseDtoHub<XTest, XTestDto, Guid>, IXTestDtoHub
|
|
{
|
|
public XTestDtoHub(ILogger<XTestDtoHub> logger) : base(logger)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestEFRepository.cs
|
|
|
|
using System;
|
|
using xDataService.Configuration;
|
|
using xDataService.Providers;
|
|
using xDataService.Interfaces;
|
|
using xServices.Databases;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestEFRepository : XBaseEFRepository<XTest, Guid, XApiDbContext>, IXTestRepository
|
|
{
|
|
public XTestEFRepository(
|
|
IXUnitOfWorks<XApiDbContext> unitOfWorks,
|
|
XDataServiceConfiguration configuration,
|
|
IXTestKeyGenerator keyGenerator = null,
|
|
IXTestRepositoryEvents baseRepositoryEvents = null
|
|
) : base(
|
|
unitOfWorks,
|
|
configuration,
|
|
keyGenerator,
|
|
baseRepositoryEvents
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestEntityHub.cs
|
|
|
|
using System;
|
|
using Microsoft.Extensions.Logging;
|
|
using xPushService.Base;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestEntityHub : XBaseEntityHub<XTest, Guid>, IXTestEntityHub
|
|
{
|
|
public XTestEntityHub(ILogger<XBaseHub> logger) : base(logger)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestGraphQLTypeHelper.cs
|
|
|
|
using System;
|
|
using xDataService.Configuration;
|
|
using xDataService.GraphQL;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestGraphQLTypeHelper : XBaseGraphQLTypeHelper<XTest, Guid>, IXTestGraphQLTypeHelper
|
|
{
|
|
public XTestGraphQLTypeHelper(
|
|
XDataServiceConfiguration configuration
|
|
) : base(configuration)
|
|
{
|
|
}
|
|
|
|
public override string GetInQueryCollectionName()
|
|
{
|
|
return "tests";
|
|
}
|
|
|
|
public override string GetInQuerySingleName()
|
|
{
|
|
return "test";
|
|
}
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestGraphQuery.cs
|
|
|
|
using System;
|
|
using GraphQL.Types;
|
|
using xDataService.Configuration;
|
|
using xDataService.GraphQL;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
using xServices.Models.GraphQL;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestGraphQuery : XBaseGraphQLQuery<XTest, Guid, XTestGraphType, GuidGraphType>
|
|
{
|
|
public XTestGraphQuery(
|
|
XDataServiceConfiguration configuration,
|
|
IXTestRepository repository,
|
|
IXTestGraphQLTypeHelper helper
|
|
) : base(
|
|
configuration,
|
|
repository,
|
|
helper
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestGraphSchema.cs
|
|
|
|
using System;
|
|
using GraphQL.Types;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestGraphSchema : Schema
|
|
{
|
|
public XTestGraphSchema(IServiceProvider services) : base(services)
|
|
{
|
|
Query = (XTestGraphQuery)services.GetService(typeof(XTestGraphQuery));
|
|
}
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestInMemoryRepository.cs
|
|
|
|
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
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestKeyGenerator.cs
|
|
|
|
using xDataService.Providers;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestKeyGenerator : XGuidKeyGenerator<XTest>, IXTestKeyGenerator
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestMongoRepository.cs
|
|
|
|
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
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestProvider.cs
|
|
|
|
using System;
|
|
using xCommons.Extensions;
|
|
using xIdentityModels.Models;
|
|
using xPushService.Providers;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestProvider : XBaseProvided<XTest, XTestDto, Guid, XTestDtoHub>, IXTestProvider
|
|
{
|
|
public XTestProvider(
|
|
IXTestServiceProvider provider
|
|
) : base(
|
|
provider,
|
|
permittedRoles: new string[] { }
|
|
)
|
|
{ }
|
|
|
|
public override bool IsOwned(
|
|
XTestDto item,
|
|
XUserClaimsInfoDto userInfo
|
|
)
|
|
{
|
|
return !item.IsNullOrDefault();
|
|
}
|
|
|
|
public override bool IsOwned(
|
|
XTest item,
|
|
XUserClaimsInfoDto userInfo
|
|
)
|
|
{
|
|
return item.IsNullOrDefault();
|
|
}
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestRepositoryEvents.cs
|
|
|
|
using xDataService.Providers;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestRepositoryEvents : XBaseRepositoryEvents<XTest>, IXTestRepositoryEvents
|
|
{ }
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestRepositoryProvider.cs
|
|
|
|
using System;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using xDataService.Configuration;
|
|
using xIdentityService.Interfaces;
|
|
using xPushService.Base;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestRepositoryProvider : XBaseEntityProvider<XTest, Guid, XTestEntityHub>, IXTestRepositoryProvider
|
|
{
|
|
public XTestRepositoryProvider(
|
|
IXTestRepository repository,
|
|
IHubContext<XTestEntityHub> hub,
|
|
XDataServiceConfiguration dataConfiguration,
|
|
IXIdentityProvider identityProvider = null
|
|
) : base(
|
|
hub: hub,
|
|
repository: repository,
|
|
identityProvider: identityProvider,
|
|
dataConfiguration: dataConfiguration
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestRepositoryService.cs
|
|
|
|
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)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestSeeder.cs
|
|
|
|
using System;
|
|
using xDataService.Configuration;
|
|
using xDataService.Providers;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestSeeder : XBaseDbSeeder<XTest, Guid>, IXTestSeeder
|
|
{
|
|
public XTestSeeder(
|
|
IXTestRepository repository,
|
|
XDataServiceConfiguration dataServiceConfiguration
|
|
) : base(
|
|
database: "xApiDb",
|
|
entity: nameof(XTest),
|
|
repository: repository,
|
|
dataServiceConfiguration: dataServiceConfiguration
|
|
)
|
|
{ }
|
|
}
|
|
}
|
|
|
|
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xServices\Providers\XTestServiceProvider.cs
|
|
|
|
using System;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using xDataService.Configuration;
|
|
using xIdentityService.Interfaces;
|
|
using xPushService.Base;
|
|
using xServices.Interfaces;
|
|
using xServices.Models.Dtos;
|
|
using xServices.Models.Entities;
|
|
|
|
namespace xServices.Providers
|
|
{
|
|
public class XTestServiceProvider : XBaseDtoProvider<XTest, XTestDto, Guid, XTestDtoHub>, IXTestServiceProvider
|
|
{
|
|
public XTestServiceProvider(
|
|
IHubContext<XTestDtoHub> hub,
|
|
IXTestRepositoryService service,
|
|
XDataServiceConfiguration dataConfiguration,
|
|
IXIdentityProvider identityProvider = null
|
|
) : base(
|
|
hub: hub,
|
|
service: service,
|
|
identityProvider: identityProvider,
|
|
dataConfiguration: dataConfiguration
|
|
)
|
|
{ }
|
|
}
|
|
}
|