Compare commits
10
Commits
ec6d99f979
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41e76a59da | ||
|
|
3560de8e63 | ||
|
|
057d891a32 | ||
|
|
cc8f3fdd1b | ||
|
|
a0709b702c | ||
|
|
b9fced926b | ||
|
|
9e8fc9a510 | ||
|
|
2b17be0575 | ||
|
|
657530b394 | ||
|
|
55ca626f03 |
@@ -0,0 +1,196 @@
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Db;
|
||||
using xDataService.Models;
|
||||
using xDataService.GraphQL;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xDataService.Builders
|
||||
{
|
||||
/// <summary>
|
||||
/// Fluent Builder for constructing XRepositoryDescriptor instances.
|
||||
/// Replaces the telescoping generic constructors (12-17 type parameters)
|
||||
/// with a readable, chainable API.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The entity type</typeparam>
|
||||
/// <typeparam name="TKey">The entity key type</typeparam>
|
||||
/// <example>
|
||||
/// var descriptor = XRepositoryDescriptor.For<XAiMessage, Guid>()
|
||||
/// .WithKeyGenerator<IXAiMessageKeyGenerator, XAiMessageKeyGenerator>()
|
||||
/// .WithEvents<IXAiMessageRepositoryEvents, XAiMessageRepositoryEvents>()
|
||||
/// .WithGraphQL<XAiMessageGraphType, GuidGraphType, XAiMessageGraphQuery,
|
||||
/// IXAiMessageGraphQLTypeHelper, XAiMessageGraphQLTypeHelper, XAiMessageGraphSchema>()
|
||||
/// .WithEFRepository<XAiApiDbContext, IXAiMessageRepository, XAiMessageEFRepository<XAiApiDbContext>>()
|
||||
/// .WithSeeder<IXAiMessageSeeder, XAiMessageSeeder>()
|
||||
/// .Build();
|
||||
/// </example>
|
||||
public sealed class XRepositoryDescriptorBuilder<TEntity, TKey>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
{
|
||||
private readonly XRepositoryDescriptor _descriptor;
|
||||
|
||||
private XRepositoryDescriptorBuilder()
|
||||
{
|
||||
_descriptor = new XRepositoryDescriptor
|
||||
{
|
||||
Entity = typeof(TEntity),
|
||||
Key = typeof(TKey)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new builder instance for the specified entity and key types.
|
||||
/// </summary>
|
||||
public static XRepositoryDescriptorBuilder<TEntity, TKey> Create()
|
||||
{
|
||||
return new XRepositoryDescriptorBuilder<TEntity, TKey>();
|
||||
}
|
||||
|
||||
//
|
||||
#region KeyGenerator
|
||||
/// <summary>
|
||||
/// Configures the Key Generator service for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKeyGeneratorService">The key generator interface</typeparam>
|
||||
/// <typeparam name="TKeyGeneratorImplementation">The key generator implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithKeyGenerator<TKeyGeneratorService, TKeyGeneratorImplementation>()
|
||||
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||
{
|
||||
_descriptor.KeyGeneratorService = typeof(TKeyGeneratorService);
|
||||
_descriptor.KeyGeneratorImplementation = typeof(TKeyGeneratorImplementation);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// Configures the Repository Events service for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEventsService">The events interface</typeparam>
|
||||
/// <typeparam name="TEventsImplementation">The events implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithEvents<TEventsService, TEventsImplementation>()
|
||||
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||
{
|
||||
_descriptor.EventsService = typeof(TEventsService);
|
||||
_descriptor.EventsImplementation = typeof(TEventsImplementation);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region GraphQL
|
||||
/// <summary>
|
||||
/// Configures the full GraphQL stack for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TGraph">The GraphQL object type</typeparam>
|
||||
/// <typeparam name="TGraphKey">The GraphQL key type</typeparam>
|
||||
/// <typeparam name="TGraphQuery">The GraphQL query type</typeparam>
|
||||
/// <typeparam name="TGraphTypeHelperService">The GraphQL type helper interface</typeparam>
|
||||
/// <typeparam name="TGraphTypeHelperImplementation">The GraphQL type helper implementation</typeparam>
|
||||
/// <typeparam name="TGraphSchema">The GraphQL schema</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithGraphQL<
|
||||
TGraph,
|
||||
TGraphKey,
|
||||
TGraphQuery,
|
||||
TGraphTypeHelperService,
|
||||
TGraphTypeHelperImplementation,
|
||||
TGraphSchema>()
|
||||
where TGraphSchema : Schema
|
||||
where TGraphKey : IGraphType
|
||||
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||
{
|
||||
_descriptor.GraphType = typeof(TGraph);
|
||||
_descriptor.GraphTypeKey = typeof(TGraphKey);
|
||||
_descriptor.GraphQuery = typeof(TGraphQuery);
|
||||
_descriptor.GraphSchema = typeof(TGraphSchema);
|
||||
_descriptor.GraphTypeHelperService = typeof(TGraphTypeHelperService);
|
||||
_descriptor.GraphTypeHelperImplementation = typeof(TGraphTypeHelperImplementation);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Repository
|
||||
/// <summary>
|
||||
/// Configures an Entity Framework Core repository for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TContext">The EF DbContext</typeparam>
|
||||
/// <typeparam name="TRepositoryService">The repository interface</typeparam>
|
||||
/// <typeparam name="TRepositoryImplementation">The repository implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithEFRepository<TContext, TRepositoryService, TRepositoryImplementation>()
|
||||
where TContext : XDbContext
|
||||
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
||||
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
||||
{
|
||||
_descriptor.Context = typeof(TContext);
|
||||
_descriptor.RepositoryService = typeof(TRepositoryService);
|
||||
_descriptor.RepositoryImplementation = typeof(TRepositoryImplementation);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures a MongoDB repository for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TRepositoryService">The repository interface</typeparam>
|
||||
/// <typeparam name="TRepositoryImplementation">The repository implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithMongoRepository<TRepositoryService, TRepositoryImplementation>()
|
||||
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
||||
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
||||
{
|
||||
_descriptor.RepositoryService = typeof(TRepositoryService);
|
||||
_descriptor.RepositoryImplementation = typeof(TRepositoryImplementation);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures an In-Memory repository for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TRepositoryService">The repository interface</typeparam>
|
||||
/// <typeparam name="TRepositoryImplementation">The repository implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithInMemoryRepository<TRepositoryService, TRepositoryImplementation>()
|
||||
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
||||
where TRepositoryImplementation : XBaseInMemoryRepository<TEntity, TKey>
|
||||
{
|
||||
_descriptor.RepositoryService = typeof(TRepositoryService);
|
||||
_descriptor.RepositoryImplementation = typeof(TRepositoryImplementation);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Seeder
|
||||
/// <summary>
|
||||
/// Configures the database seeder for the entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSeederService">The seeder interface</typeparam>
|
||||
/// <typeparam name="TSeederImplementation">The seeder implementation</typeparam>
|
||||
public XRepositoryDescriptorBuilder<TEntity, TKey> WithSeeder<TSeederService, TSeederImplementation>()
|
||||
where TSeederService : IXBaseDbSeeder<TEntity, TKey>
|
||||
where TSeederImplementation : XBaseDbSeeder<TEntity, TKey>
|
||||
{
|
||||
_descriptor.SeederService = typeof(TSeederService);
|
||||
_descriptor.SeederImplementation = typeof(TSeederImplementation);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Build
|
||||
/// <summary>
|
||||
/// Builds and returns the configured XRepositoryDescriptor.
|
||||
/// </summary>
|
||||
/// <returns>The fully configured descriptor</returns>
|
||||
public XRepositoryDescriptor Build()
|
||||
{
|
||||
return _descriptor;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Constants;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Configuration
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Constants;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Configuration
|
||||
{
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Providers;
|
||||
using xExceptions.Constants;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using xDataService.Interfaces;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Controllers;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using xDataService.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Controllers
|
||||
{
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Controllers;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Providers;
|
||||
using xDataService.Interfaces;
|
||||
using xExceptions.Constants;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Controllers;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Configurations;
|
||||
using xDataService.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Controllers
|
||||
{
|
||||
|
||||
+11
-11
@@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xCommons.Helpers;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using xDataService.Helpers;
|
||||
using xExceptions.Constants;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Helpers;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Helpers;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xExceptions.Constants;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace xDataService.DI
|
||||
{
|
||||
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Helpers;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace xDataService.Db
|
||||
{
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace xDataService.Db {
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using MySql.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace xDataService.Extensions {
|
||||
public static class DbContextOptionExtensions {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using xCommons.Extensions;
|
||||
using xModels.Base;
|
||||
using xCommons.Extensions;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Extensions {
|
||||
public static class EntityExtensions {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Constants;
|
||||
using xExceptions.Constants;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Reflection;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Constants;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
@@ -22,6 +22,7 @@ namespace xDataService.Extensions
|
||||
/// <param name="source"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IQueryable<T> ApplyFilter<T, TKey>(
|
||||
this IQueryable<T> source,
|
||||
@@ -40,6 +41,7 @@ namespace xDataService.Extensions
|
||||
/// <param name="source"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static async Task<IQueryable<T>> ApplyFilterAsync<T, TKey>(
|
||||
this IQueryable<T> source,
|
||||
@@ -84,6 +86,7 @@ namespace xDataService.Extensions
|
||||
/// <param name="source"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static async Task<IEnumerable<T>> ApplyFilterAsync<T, TKey>(
|
||||
this IEnumerable<T> source,
|
||||
@@ -319,6 +322,7 @@ namespace xDataService.Extensions
|
||||
/// <param name="isAscending"></param>
|
||||
/// <param name="columnsMap"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IQueryable<T> ApplySorting<T, TKey>(
|
||||
this IQueryable<T> source,
|
||||
@@ -372,6 +376,7 @@ namespace xDataService.Extensions
|
||||
/// <param name="isAscending"></param>
|
||||
/// <param name="columnsMap"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<T> ApplySorting<T, TKey>(
|
||||
this IEnumerable<T> source,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Configuration;
|
||||
|
||||
namespace xDataService.Extensions {
|
||||
public static class XDataServiceConfigurationExtensions {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Models;
|
||||
using xDataService.Constants;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using GraphQL;
|
||||
using xModels.Dtos;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Constants;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xDataService.Extensions {
|
||||
public static class XGraphQLExtensions {
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Core.Bindings;
|
||||
using MongoDB.Driver.Core.Clusters;
|
||||
using MongoDB.Driver.Core.Servers;
|
||||
using MongoDB.Driver.Core.WireProtocol.Messages.Encoders;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xDataService.Mongo;
|
||||
using MongoDB.Driver.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Extensions {
|
||||
public static class XMongoDbExtensions {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
public static class XReferenceExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts an XReference<T> to String Representation ...
|
||||
/// Converts an XReference to String Representation ...
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
@@ -42,7 +42,7 @@ namespace xDataService.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse an String and Extract to XReference<T> if it's Described ...
|
||||
/// Parse an String and Extract to XReference if it's Described ...
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
@@ -75,9 +75,10 @@ namespace xDataService.Extensions
|
||||
try
|
||||
{
|
||||
referencedTo = (T)Convert.ChangeType(parts[1], typeof(T));
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
referencedTo = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(parts[1]);
|
||||
referencedTo = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(parts[1]);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -96,7 +97,7 @@ namespace xDataService.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Collection of XReference<T> to it's String Representation ...
|
||||
/// Converts a Collection of XReference to it's String Representation ...
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
@@ -150,7 +151,7 @@ namespace xDataService.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse an string to XReference<T> Collection Representation ...
|
||||
/// Parse an string to XReference Collection Representation ...
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using xCommons.Extensions;
|
||||
using xModels.Base;
|
||||
using xDataService.Db;
|
||||
using xDataService.Interfaces;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xModels.Base;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using GraphQL.Types;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xDataService.GraphQL
|
||||
{
|
||||
/// <summary>
|
||||
/// Base Entity GraphType Object ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public abstract class XBaseGraphObjectType<TEntity, TKey> : ObjectGraphType<TEntity>
|
||||
where TEntity : XBaseEntity<TKey> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.GraphQL {
|
||||
public class XBaseGraphQLEventType<TEntity, TKey, TGraphType> : ObjectGraphType<XBaseEventModel<TEntity>>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Models;
|
||||
using xDataService.Constants;
|
||||
using System.Linq.Expressions;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
using xDataService.Configuration;
|
||||
|
||||
namespace xDataService.GraphQL
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using GraphQL.Resolvers;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using GraphQL.Resolvers;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.GraphQL {
|
||||
public abstract class XBaseGraphQLSubscription<TEntity, TKey, TGraph> : ObjectGraphType
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Configuration;
|
||||
|
||||
namespace xDataService.GraphQL
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xCommons.Extensions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Helpers {
|
||||
public partial class XCursorHelper {
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GraphQL;
|
||||
using GraphQL.Server;
|
||||
using GraphQL.Server.Ui.Playground;
|
||||
using GraphQL.Server.Ui.Voyager;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using GraphQL.Server;
|
||||
using xDataService.Db;
|
||||
using System.Reflection;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using xDataService.GraphQL;
|
||||
using xExceptions.Constants;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Providers;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using GraphQL.Server.Ui.Voyager;
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using GraphQL.Server.Ui.Playground;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using MySql.EntityFrameworkCore.Extensions;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Db;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.GraphQL;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xExceptions.Constants;
|
||||
using xModels.Base;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xDataService.Helpers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xModels.Dtos;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Models;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xDataService.Constants {
|
||||
public static class XGraphQLHelper {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xModels.Base;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Configuration;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
public interface IXBaseEnricher<TSource, TDest>
|
||||
{
|
||||
Task EnrichAsync(
|
||||
TSource source,
|
||||
TDest destination,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task EnrichRangeAsync(
|
||||
IEnumerable<TSource> sources,
|
||||
IEnumerable<TDest> destinations,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using GraphQL.Types;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Models;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xDataService.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
@@ -14,7 +14,6 @@ namespace xDataService.Interfaces
|
||||
/// an Interface for Base Repository Actions Providing Using Controllers ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public interface IXBaseRepositoryController<TEntity, TKey>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Interfaces {
|
||||
public interface IXBaseRepositoryEvents<T> {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Db;
|
||||
using xDataService.Models;
|
||||
using xDataService.Constants;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using xDataService.Db;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Db;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Interfaces {
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Db;
|
||||
using xDataService.DI;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xDataService.Models
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using GraphQL.Types;
|
||||
using xModels.Dtos;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xDataService.Models {
|
||||
public class XGraphQueryResult<TEntity, TGraph> : ObjectGraphType<XQueryResult<TEntity>>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using GraphQL.Types;
|
||||
using xModels.Dtos;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xDataService.Models {
|
||||
public class XGraphQueryType : InputObjectGraphType<XQuery> {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Db;
|
||||
using xDataService.GraphQL;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xModels.Base;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xDataService.Models
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Driver;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Driver;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Mongo {
|
||||
public class XAsyncEnumerableAdapter<T> : IAsyncEnumerable<T> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Driver;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Driver;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Mongo {
|
||||
public class XMongoAsyncCursor<T> : IAsyncCursor<T> {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xModels.Base;
|
||||
using MongoDB.Driver;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using MongoDB.Driver.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Mongo {
|
||||
public class XMongoQueryable<TEntity, TKey> : IMongoQueryable<TEntity>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using xModels.Base;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using xDataService.Db;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
@@ -733,14 +732,17 @@ namespace xDataService.Providers
|
||||
{
|
||||
predicator = x => !x.Deleted;
|
||||
}
|
||||
var result = (await AsQueryable(
|
||||
var list = await AsQueryable(
|
||||
asNoTracking: true,
|
||||
orderBuilder: null,
|
||||
predicate: predicator,
|
||||
includeBuilder: includeBuilder
|
||||
)
|
||||
.ToListAsync(cancellationToken))
|
||||
.FirstOrDefault(predicate.Compile());
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
//
|
||||
var whereClause = predicate.Compile();
|
||||
var result = list.FirstOrDefault(x => whereClause(x));
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using xModels.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using System.Collections.Concurrent;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using MongoDB.Driver;
|
||||
using System.Threading;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xDataService.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Models;
|
||||
using System.Reactive.Linq;
|
||||
using xDataService.Interfaces;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xDataService.Providers {
|
||||
/// <summary>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
@@ -19,9 +19,6 @@ namespace xDataService.Providers
|
||||
/// and provides Data Manipulation Methods using Dtos instead of Entities ...
|
||||
///
|
||||
/// it can be use of following Repository Patterns Implementation:
|
||||
/// <see cref="XBaseEFRepository"/>>
|
||||
/// <see cref="XBaseMongoRepository"/>>
|
||||
/// <see cref="XBaseInMemoryRepository"/>>
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
@@ -108,7 +105,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> AddAsync(
|
||||
public virtual async Task<TDto> AddAsync(
|
||||
TDto item,
|
||||
bool saveChanges = true,
|
||||
CancellationToken cancellationToken = default
|
||||
@@ -155,7 +152,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> AddOrUpdateAsync(
|
||||
public virtual async Task<TDto> AddOrUpdateAsync(
|
||||
TDto item,
|
||||
bool saveChanges = true,
|
||||
CancellationToken cancellationToken = default
|
||||
@@ -202,15 +199,12 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task AddRangeAsync(
|
||||
public virtual async Task AddRangeAsync(
|
||||
IEnumerable<TDto> items,
|
||||
bool saveChanges = true,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
TDto result = null;
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool isValid =
|
||||
@@ -249,7 +243,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> UpdateAsync(
|
||||
public virtual async Task<TDto> UpdateAsync(
|
||||
TKey id,
|
||||
TDto item,
|
||||
bool saveChanges = true,
|
||||
@@ -290,7 +284,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> UpdateRangeAsync(
|
||||
public virtual async Task<bool> UpdateRangeAsync(
|
||||
IEnumerable<TDto> items,
|
||||
bool saveChanges = true,
|
||||
CancellationToken cancellationToken = default
|
||||
@@ -339,7 +333,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> RemoveAsync(
|
||||
public virtual async Task<TDto> RemoveAsync(
|
||||
TKey id,
|
||||
bool softDelete = true,
|
||||
bool saveChanges = true,
|
||||
@@ -378,7 +372,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> RemoveAsync(
|
||||
public virtual async Task<TDto> RemoveAsync(
|
||||
TDto item,
|
||||
bool softDelete = true,
|
||||
bool saveChanges = true,
|
||||
@@ -420,7 +414,7 @@ namespace xDataService.Providers
|
||||
/// <param name="saveChanges"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task RemoveRangeAsync(
|
||||
public virtual async Task RemoveRangeAsync(
|
||||
IEnumerable<TDto> items,
|
||||
bool softDelete = true,
|
||||
bool saveChanges = true,
|
||||
@@ -464,7 +458,7 @@ namespace xDataService.Providers
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> CountAsync(
|
||||
public virtual async Task<int> CountAsync(
|
||||
bool ignoreSoftDeleteds = true,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
@@ -487,7 +481,7 @@ namespace xDataService.Providers
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> PagesCountAsync(
|
||||
public virtual async Task<int> PagesCountAsync(
|
||||
int pageSize,
|
||||
int? totalItems = null,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
@@ -516,7 +510,7 @@ namespace xDataService.Providers
|
||||
/// <param name="ignoreSoftDeleteds"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> IsExistsAsync(
|
||||
public virtual async Task<bool> IsExistsAsync(
|
||||
TKey id,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
CancellationToken cancellationToken = default
|
||||
@@ -544,7 +538,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> GetAsync(
|
||||
public virtual async Task<TDto> GetAsync(
|
||||
TKey id,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
@@ -583,7 +577,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<TDto>> GetAllAsync(
|
||||
public virtual async Task<IEnumerable<TDto>> GetAllAsync(
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
@@ -623,7 +617,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
|
||||
public virtual async IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
@@ -658,7 +652,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TDto> FindOneAsync(
|
||||
public virtual async Task<TDto> FindOneAsync(
|
||||
Expression<Func<TEntity, bool>> predicate,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||
@@ -698,7 +692,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<TDto>> FindManyAsync(
|
||||
public virtual async Task<IEnumerable<TDto>> FindManyAsync(
|
||||
Expression<Func<TEntity, bool>> predicate,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||
@@ -741,7 +735,7 @@ namespace xDataService.Providers
|
||||
/// <param name="includeBuilder"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XQueryResult<TDto>> QueryAsync(
|
||||
public virtual async Task<XQueryResult<TDto>> QueryAsync(
|
||||
XQuery query,
|
||||
bool ignoreSoftDeleteds = true,
|
||||
Expression<Func<TEntity, bool>> predicate = null,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
@@ -51,7 +51,6 @@ namespace xDataService.Providers
|
||||
{
|
||||
//
|
||||
var entityTypes = new List<Type>();
|
||||
// path = Path.Combine (Directory.GetCurrentDirectory ());
|
||||
var path = Path.Combine (AppContext.BaseDirectory);
|
||||
var files = Directory.GetFiles(path, "*.dll");
|
||||
foreach (var dll in files)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Linq;
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
<packageSources>
|
||||
<!-- <add key="megan" value="https://hub.megan.ir/nuget/index.json" /> -->
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" />
|
||||
<!-- <add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" /> -->
|
||||
</packageSources>
|
||||
</configuration>
|
||||
+3
-3
@@ -20,7 +20,7 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<ItemGroup>
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
<None Include="../../Documents/Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
PackagePath="\icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
|
||||
<!-- For XML Documentation Support -->
|
||||
<PropertyGroup>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user