This commit is contained in:
2026-05-09 22:22:02 +03:30
parent 6b6790b61a
commit 2a0e8e4074
17 changed files with 205 additions and 5 deletions
+12
View File
@@ -0,0 +1,12 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using xServices.Models.Entities;
namespace xServices.Configurations
{
public class XTestConfiguration : IEntityTypeConfiguration<XTest>
{
public void Configure(EntityTypeBuilder<XTest> builder)
{ }
}
}
+8 -5
View File
@@ -1,6 +1,11 @@
using System;
using System.Collections.Generic;
using GraphQL.Types;
using xDataService.Interfaces;
using xDataService.Models;
using xServices.Interfaces;
using xServices.Models.Entities;
using xServices.Providers;
namespace xServices.Databases
{
@@ -12,14 +17,12 @@ namespace xServices.Databases
{
//
// XTest Entity ...
// new XRepositoryDescriptor
// {
// //
// }
new XEFRepositoryDescriptor<XTest, Guid, IXTestKeyGenerator, XTestKeyGenerator, IXTestRepositoryEvents, XTestRepositoryEvents, XTestGraphType, GuidGraphType, IXTestGraphQuery, XTestGraphQuery, IXTestGraphQLTypeHelper, XTestGraphQLTypeHelper, XTestGraphSchema, IXTestRepository, XTestEFRepository, XApiDbContext>
{}
}
)
{
// Context = XApiDbContext;
OptionsBuilder = b => b.MigrationsAssembly("xApi");
}
}
}
+2
View File
@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using xDataService.Configuration;
using xDataService.Db;
using xServices.Models.Entities;
namespace xServices.Databases
{
@@ -8,6 +9,7 @@ namespace xServices.Databases
{
//
#region DbSets ...
public DbSet<XTest> Tests { get; set; }
#endregion
//
+9
View File
@@ -0,0 +1,9 @@
using System;
using xDataService.Interfaces;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XTest, Guid>
{ }
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using GraphQL.Types;
using xDataService.Interfaces;
using xServices.Models.Entities;
using xServices.Providers;
namespace xServices.Interfaces
{
public interface IXTestGraphQuery : IXBaseGraphQLQuery<XTest, Guid, XTestGraphType, GuidGraphType>
{}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
using xDataService.Interfaces;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestKeyGenerator : IXKeyGenerator<XTest, Guid>
{ }
}
+9
View File
@@ -0,0 +1,9 @@
using System;
using xDataService.Interfaces;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestRepository : IXBaseRepository<XTest, Guid>
{ }
}
+8
View File
@@ -0,0 +1,8 @@
using xDataService.Interfaces;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestRepositoryEvents : IXBaseRepositoryEvents<XTest>
{ }
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using xModels.Base;
namespace xServices.Models.Dtos
{
public class XTestDto :XBaseEntityDto<Guid>
{
public string Firstname { get; set; }
public string Lastname { get; set; }
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using xModels.Base;
namespace xServices.Models.Entities
{
public class XTest : XBaseEntity<Guid>
{
public string Firstname { get; set; }
public string Lastname { get; set; }
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using xDataService.Configuration;
using xDataService.EFRepositories;
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
)
{ }
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using xDataService.GraphQL;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestGraphQLTypeHelper : XBaseGraphQLTypeHelper<XTest, Guid>, IXTestGraphQLTypeHelper
{
public override string GetInQueryCollectionName()
{
return "tests";
}
public override string GetInQuerySingleName()
{
return "test";
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using GraphQL.Types;
using xDataService.Configuration;
using xDataService.GraphQL;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestGraphQuery : XBaseGraphQLQuery<XTest, Guid, XTestGraphType, GuidGraphType>, IXTestGraphQuery
{
public XTestGraphQuery(
XDataServiceConfiguration configuration,
IXTestRepository repository,
IXTestGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using GraphQL.Types;
namespace xServices.Providers
{
public class XTestGraphSchema : Schema
{
public XTestGraphSchema(IServiceProvider services) : base(services)
{
Query = (XTestGraphQuery)services.GetService(typeof(XTestGraphQuery));
}
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using xDataService.GraphQL;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestGraphType : XBaseGraphObjectType<XTest, Guid>
{
public XTestGraphType() : base()
{
Field(x => x.Firstname);
Field(x => x.Lastname);
}
}
}
+9
View File
@@ -0,0 +1,9 @@
using xDataService.Providers;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestKeyGenerator : XGuidKeyGenerator<XTest>, IXTestKeyGenerator
{ }
}
+9
View File
@@ -0,0 +1,9 @@
using xDataService.Events;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestRepositoryEvents : XBaseRepositoryEvents<XTest>, IXTestRepositoryEvents
{ }
}