refactoring, improvements, fixes, etc...
This commit is contained in:
parent
03698af809
commit
f5e7133022
|
|
@ -1,6 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AyCode.Database.Extensions;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
|
||||
namespace AyCode.Database.DbContexts;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ using Microsoft.EntityFrameworkCore.Metadata;
|
|||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AyCode.Database.Extensions
|
||||
namespace AyCode.Database.DbContexts
|
||||
{
|
||||
public static class AcDbContextExtension
|
||||
public static class AcDbContextExtension
|
||||
{
|
||||
|
||||
public static IEntityType? GetEntityType<TEntity>(this DbContext ctx)
|
||||
|
|
@ -52,7 +52,7 @@ namespace AyCode.Database.Extensions
|
|||
|
||||
foreach (var prop in originalValues.Properties)
|
||||
{
|
||||
if (object.Equals(originalValues[prop.Name], currentValues[prop.Name]) == false)
|
||||
if (Equals(originalValues[prop.Name], currentValues[prop.Name]) == false)
|
||||
{
|
||||
yield return prop;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AyCode.Database.DbContexts;
|
||||
|
||||
public interface IAcEntityTypeConfiguration<TEntity> : IEntityTypeConfiguration<TEntity> where TEntity : class, IEntity
|
||||
{ }
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using AyCode.Interfaces.Users;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace AyCode.Database.ModelBuilders.Users;
|
||||
|
||||
public static class AcUserEntityTypeBuilderExtensions
|
||||
{
|
||||
public static void BuildUserToProfileRelation<TUser>(this EntityTypeBuilder<TUser> modelBuilder) where TUser : class, IUserBase
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void BuildUserToAddressRelation<TUser>(this EntityTypeBuilder<TUser> modelBuilder) where TUser : class, IUserBase
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using AyCode.Database.DbContexts;
|
||||
using AyCode.Interfaces.Users;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace AyCode.Database.ModelBuilders.Users;
|
||||
|
||||
public abstract class AcUserEntityTypeDefaultConfiguration<TUser> : IAcEntityTypeConfiguration<TUser> where TUser : class, IUserBase
|
||||
{
|
||||
public virtual void Configure(EntityTypeBuilder<TUser> modelBuilder)
|
||||
{
|
||||
modelBuilder.BuildUserToProfileRelation();
|
||||
modelBuilder.BuildUserToAddressRelation();
|
||||
}
|
||||
}
|
||||
|
|
@ -6,12 +6,13 @@ using AyCode.Interfaces.ServiceProviders;
|
|||
namespace AyCode.Entities.ServiceProviders
|
||||
{
|
||||
[Table("ServiceProviders")]
|
||||
public class ServiceProviderBase : IServiceProviderBase
|
||||
public abstract class ServiceProviderBase : IServiceProviderBase
|
||||
{
|
||||
public ServiceProviderBase() { }
|
||||
protected ServiceProviderBase() { }
|
||||
|
||||
public ServiceProviderBase(string name, Guid ownerId ) : this(Guid.NewGuid(), name, ownerId) { }
|
||||
public ServiceProviderBase(Guid id, string name, Guid ownerId) : this()
|
||||
protected ServiceProviderBase(string name, Guid ownerId ) : this(Guid.NewGuid(), name, ownerId) { }
|
||||
|
||||
protected ServiceProviderBase(Guid id, string name, Guid ownerId) : this()
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
|
|
|
|||
Loading…
Reference in New Issue