diff --git a/Configurations/XTestConfiguration.cs b/Configurations/XTestConfiguration.cs new file mode 100644 index 0000000..bda491e --- /dev/null +++ b/Configurations/XTestConfiguration.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using xServices.Models.Entities; + +namespace xServices.Configurations +{ + public class XTestConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { } + } +} \ No newline at end of file diff --git a/Databases/XApiDatabaseDescriptor.cs b/Databases/XApiDatabaseDescriptor.cs index fec8514..5675e8c 100644 --- a/Databases/XApiDatabaseDescriptor.cs +++ b/Databases/XApiDatabaseDescriptor.cs @@ -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 + {} } ) { - // Context = XApiDbContext; + OptionsBuilder = b => b.MigrationsAssembly("xApi"); } } } \ No newline at end of file diff --git a/Databases/XApiDbContext.cs b/Databases/XApiDbContext.cs index 7e29eb4..e53613b 100644 --- a/Databases/XApiDbContext.cs +++ b/Databases/XApiDbContext.cs @@ -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 Tests { get; set; } #endregion // diff --git a/Interfaces/IXTestGraphQLTypeHelper.cs b/Interfaces/IXTestGraphQLTypeHelper.cs new file mode 100644 index 0000000..fb66074 --- /dev/null +++ b/Interfaces/IXTestGraphQLTypeHelper.cs @@ -0,0 +1,9 @@ +using System; +using xDataService.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Interfaces +{ + public interface IXTestGraphQLTypeHelper : IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/IXTestGraphQuery.cs b/Interfaces/IXTestGraphQuery.cs new file mode 100644 index 0000000..5ca0a66 --- /dev/null +++ b/Interfaces/IXTestGraphQuery.cs @@ -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 + {} +} \ No newline at end of file diff --git a/Interfaces/IXTestKeyGenerator.cs b/Interfaces/IXTestKeyGenerator.cs new file mode 100644 index 0000000..59409ca --- /dev/null +++ b/Interfaces/IXTestKeyGenerator.cs @@ -0,0 +1,9 @@ +using System; +using xDataService.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Interfaces +{ + public interface IXTestKeyGenerator : IXKeyGenerator + { } +} \ No newline at end of file diff --git a/Interfaces/IXTestRepository.cs b/Interfaces/IXTestRepository.cs new file mode 100644 index 0000000..a3e2ee5 --- /dev/null +++ b/Interfaces/IXTestRepository.cs @@ -0,0 +1,9 @@ +using System; +using xDataService.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Interfaces +{ + public interface IXTestRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Interfaces/IXTestRepositoryEvents.cs b/Interfaces/IXTestRepositoryEvents.cs new file mode 100644 index 0000000..3a9755e --- /dev/null +++ b/Interfaces/IXTestRepositoryEvents.cs @@ -0,0 +1,8 @@ +using xDataService.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Interfaces +{ + public interface IXTestRepositoryEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Models/Dtos/XTestDto.cs b/Models/Dtos/XTestDto.cs new file mode 100644 index 0000000..cf15f7e --- /dev/null +++ b/Models/Dtos/XTestDto.cs @@ -0,0 +1,11 @@ +using System; +using xModels.Base; + +namespace xServices.Models.Dtos +{ + public class XTestDto :XBaseEntityDto + { + public string Firstname { get; set; } + public string Lastname { get; set; } + } +} \ No newline at end of file diff --git a/Models/Entities/XTest.cs b/Models/Entities/XTest.cs new file mode 100644 index 0000000..178270e --- /dev/null +++ b/Models/Entities/XTest.cs @@ -0,0 +1,11 @@ +using System; +using xModels.Base; + +namespace xServices.Models.Entities +{ + public class XTest : XBaseEntity + { + public string Firstname { get; set; } + public string Lastname { get; set; } + } +} \ No newline at end of file diff --git a/Providers/XTestEFRepository.cs b/Providers/XTestEFRepository.cs new file mode 100644 index 0000000..601acf0 --- /dev/null +++ b/Providers/XTestEFRepository.cs @@ -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, IXTestRepository + { + public XTestEFRepository( + IXUnitOfWorks unitOfWorks, + XDataServiceConfiguration configuration, + IXTestKeyGenerator keyGenerator = null, + IXTestRepositoryEvents baseRepositoryEvents = null + ) : base( + unitOfWorks, + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XTestGraphQLTypeHelper.cs b/Providers/XTestGraphQLTypeHelper.cs new file mode 100644 index 0000000..84cc9dc --- /dev/null +++ b/Providers/XTestGraphQLTypeHelper.cs @@ -0,0 +1,20 @@ +using System; +using xDataService.GraphQL; +using xServices.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Providers +{ + public class XTestGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXTestGraphQLTypeHelper + { + public override string GetInQueryCollectionName() + { + return "tests"; + } + + public override string GetInQuerySingleName() + { + return "test"; + } + } +} \ No newline at end of file diff --git a/Providers/XTestGraphQuery.cs b/Providers/XTestGraphQuery.cs new file mode 100644 index 0000000..fe895fe --- /dev/null +++ b/Providers/XTestGraphQuery.cs @@ -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, IXTestGraphQuery + { + public XTestGraphQuery( + XDataServiceConfiguration configuration, + IXTestRepository repository, + IXTestGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XTestGraphSchema.cs b/Providers/XTestGraphSchema.cs new file mode 100644 index 0000000..aaeab80 --- /dev/null +++ b/Providers/XTestGraphSchema.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/Providers/XTestGraphType.cs b/Providers/XTestGraphType.cs new file mode 100644 index 0000000..9a33529 --- /dev/null +++ b/Providers/XTestGraphType.cs @@ -0,0 +1,15 @@ +using System; +using xDataService.GraphQL; +using xServices.Models.Entities; + +namespace xServices.Providers +{ + public class XTestGraphType : XBaseGraphObjectType + { + public XTestGraphType() : base() + { + Field(x => x.Firstname); + Field(x => x.Lastname); + } + } +} \ No newline at end of file diff --git a/Providers/XTestKeyGenerator.cs b/Providers/XTestKeyGenerator.cs new file mode 100644 index 0000000..a4e98a5 --- /dev/null +++ b/Providers/XTestKeyGenerator.cs @@ -0,0 +1,9 @@ +using xDataService.Providers; +using xServices.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Providers +{ + public class XTestKeyGenerator : XGuidKeyGenerator, IXTestKeyGenerator + { } +} \ No newline at end of file diff --git a/Providers/XTestRepositoryEvents.cs b/Providers/XTestRepositoryEvents.cs new file mode 100644 index 0000000..0718144 --- /dev/null +++ b/Providers/XTestRepositoryEvents.cs @@ -0,0 +1,9 @@ +using xDataService.Events; +using xServices.Interfaces; +using xServices.Models.Entities; + +namespace xServices.Providers +{ + public class XTestRepositoryEvents : XBaseRepositoryEvents, IXTestRepositoryEvents + { } +} \ No newline at end of file