Compare commits

...

3 Commits

Author SHA1 Message Date
jozsef.b@aycode.com 2ce2273a53 fix 2024-05-26 12:11:44 +02:00
jozsef.b@aycode.com 6fefa1e9d9 Add Profile to ServiceProvider; ServiceProvider to Company in progress... 2024-05-26 09:12:37 +02:00
jozsef.b@aycode.com 4ce3ffea84 improvements, fixes, etc 2024-05-25 22:16:22 +02:00
64 changed files with 364 additions and 173 deletions

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -8,7 +8,7 @@ using AyCode.Entities.ServiceProviders;
namespace AyCode.Core.Tests.Internal.Entities;
public class Company : AcServiceProvider<User, UserToCompany>
public class Company : AcCompany<User, UserToCompany, Profile>
{
}

View File

@ -8,7 +8,7 @@ using AyCode.Entities.Users;
namespace AyCode.Core.Tests.Internal.Entities;
public class UserToCompany: AcUserToServiceProvider<User, Company>
public class UserToCompany: AcUserToCompany<User, Company>
{
}

View File

@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -42,75 +42,107 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Product|Any CPU = Product|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Product|Any CPU.ActiveCfg = Product|Any CPU
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Product|Any CPU.Build.0 = Product|Any CPU
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CCC4969-7306-4747-8A58-80AC5A062EE1}.Release|Any CPU.Build.0 = Release|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Product|Any CPU.ActiveCfg = Product|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Product|Any CPU.Build.0 = Product|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2105535-1397-4307-B61B-E49C983353B9}.Release|Any CPU.Build.0 = Release|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Product|Any CPU.ActiveCfg = Product|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Product|Any CPU.Build.0 = Product|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB027D80-8949-403B-9A86-8E99F305016E}.Release|Any CPU.Build.0 = Release|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Product|Any CPU.ActiveCfg = Product|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Product|Any CPU.Build.0 = Product|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAB60420-9F66-42D9-B67E-8E837DBA1F30}.Release|Any CPU.Build.0 = Release|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Product|Any CPU.ActiveCfg = Product|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Product|Any CPU.Build.0 = Product|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC42F79D-EEF0-4F32-8608-230F24C6F22A}.Release|Any CPU.Build.0 = Release|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Product|Any CPU.ActiveCfg = Product|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Product|Any CPU.Build.0 = Product|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B5AC35E-3E71-42DC-B503-80D6D3089F91}.Release|Any CPU.Build.0 = Release|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Product|Any CPU.ActiveCfg = Product|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Product|Any CPU.Build.0 = Product|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8ECCA33-B5EA-490D-B1A1-D33B5E4238A5}.Release|Any CPU.Build.0 = Release|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Product|Any CPU.ActiveCfg = Product|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Product|Any CPU.Build.0 = Product|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35D47907-CE4F-435B-823E-A02BE59C16D7}.Release|Any CPU.Build.0 = Release|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Product|Any CPU.ActiveCfg = Product|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Product|Any CPU.Build.0 = Product|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBC6371C-9454-473D-9547-DF9DECEB2D2A}.Release|Any CPU.Build.0 = Release|Any CPU
{15272F57-771E-47BE-A960-AD75935254D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15272F57-771E-47BE-A960-AD75935254D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15272F57-771E-47BE-A960-AD75935254D0}.Product|Any CPU.ActiveCfg = Product|Any CPU
{15272F57-771E-47BE-A960-AD75935254D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{320A245F-6731-476D-A9D8-77888E6B5D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{320A245F-6731-476D-A9D8-77888E6B5D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{320A245F-6731-476D-A9D8-77888E6B5D9C}.Product|Any CPU.ActiveCfg = Product|Any CPU
{320A245F-6731-476D-A9D8-77888E6B5D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Product|Any CPU.ActiveCfg = Product|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Product|Any CPU.Build.0 = Product|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21392620-7D0E-44B6-9485-93C57F944C20}.Release|Any CPU.Build.0 = Release|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Product|Any CPU.ActiveCfg = Product|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Product|Any CPU.Build.0 = Product|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58C8A6A7-D624-4E32-93B9-16B879405CAA}.Release|Any CPU.Build.0 = Release|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Product|Any CPU.ActiveCfg = Product|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Product|Any CPU.Build.0 = Product|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44CF90C8-76E4-4BD6-A957-E8F7AE019B06}.Release|Any CPU.Build.0 = Release|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Product|Any CPU.ActiveCfg = Product|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Product|Any CPU.Build.0 = Product|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C74C94F-2FEB-47F7-ABB3-B0C9CBCCC876}.Release|Any CPU.Build.0 = Release|Any CPU
{9AC9AF60-280A-4871-A7FA-69AB4D0C858A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AC9AF60-280A-4871-A7FA-69AB4D0C858A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AC9AF60-280A-4871-A7FA-69AB4D0C858A}.Product|Any CPU.ActiveCfg = Product|Any CPU
{9AC9AF60-280A-4871-A7FA-69AB4D0C858A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE2DD6A4-A906-4BA6-8AAA-2A0433DF523F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE2DD6A4-A906-4BA6-8AAA-2A0433DF523F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE2DD6A4-A906-4BA6-8AAA-2A0433DF523F}.Product|Any CPU.ActiveCfg = Product|Any CPU
{DE2DD6A4-A906-4BA6-8AAA-2A0433DF523F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73261A8C-FB41-4C4C-90D4-ED5EEC991413}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73261A8C-FB41-4C4C-90D4-ED5EEC991413}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73261A8C-FB41-4C4C-90D4-ED5EEC991413}.Product|Any CPU.ActiveCfg = Product|Any CPU
{73261A8C-FB41-4C4C-90D4-ED5EEC991413}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution

79
AyCode.Core/AcDomain.cs Normal file
View File

@ -0,0 +1,79 @@
namespace AyCode.Core
{
/// <summary>
/// Singleton!
/// </summary>
public sealed class AcDomain
{
private readonly object _forLock = new();
private static readonly AcDomain Instance = new();
private int _uniqueInt32;
private long _uniqueInt64;
private string _processName;
public string ProcessName => Instance._processName;
static AcDomain()
{ }
private AcDomain()
{
//AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
//{
// var ex = (Exception) args?.ExceptionObject;
// if (ex == null) Instance._logger.Error($"GLOBAL EXCEPTION");
// else Instance._logger.Error($"GLOBAL EXCEPTION{Env.NL}{ex.Message}{Env.NL}{sender}", ex);
//};
//_processName = System.Diagnostics.Process.GetCurrentProcess()?.ProcessName ?? "Unknown ProcessName";
}
public static bool IsDeveloperVersion
{
get
{
#if Product
{
return false;
}
#endif
return true;
}
}
public static bool IsProductVersion
{
get
{
#if Product
{
return true;
}
#endif
return false;
}
}
//public static string CdnBaseUrl => IsProductVersion ? "https://cdn2.anataworld.com/" : "https://cdn2.anataworld.com/";
/// <summary>
///
/// </summary>
/// <param name="multiplier"></param>
/// <returns>(int)(multiplier * Environment.ProcessorCount), but minimum: 1</returns>
public static int ProcessorCount(double multiplier = 1)
{
var pCount = (int)(multiplier * Environment.ProcessorCount);
return pCount > 0 ? pCount : ++pCount;
}
public static int NextUniqueInt32 => Interlocked.Increment(ref Instance._uniqueInt32);
public static long NextUniqueInt64 => Interlocked.Increment(ref Instance._uniqueInt64);
}
}

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -24,6 +24,6 @@ public static class SerializeObjectExtensions
public static byte[] ToMessagePack(this object message) => MessagePackSerializer.Serialize(message);
public static byte[] ToMessagePack(this object message, MessagePackSerializerOptions options) => MessagePackSerializer.Serialize(message, options);
public static T? MessagePackTo<T>(this byte[] message) => MessagePackSerializer.Deserialize<T>(message);
public static T? MessagePackTo<T>(this byte[] message, MessagePackSerializerOptions options) => MessagePackSerializer.Deserialize<T>(message, options);
public static T MessagePackTo<T>(this byte[] message) => MessagePackSerializer.Deserialize<T>(message);
public static T MessagePackTo<T>(this byte[] message, MessagePackSerializerOptions options) => MessagePackSerializer.Deserialize<T>(message, options);
}

View File

@ -0,0 +1,40 @@
using AyCode.Core.Consts;
namespace AyCode.Core.Helpers
{
public static class AcCharGenerator
{
public static readonly char[] Letters;
public static readonly char[] Numbers;
public static readonly char[] LettersAndNumbers;
static AcCharGenerator()
{
//"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Numbers = "0123456789".ToCharArray();
Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
LettersAndNumbers = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
}
private static char[] GetRandomChars() => GetRandomChars(LettersAndNumbers, 8, 12);
private static char[] GetRandomChars(int length) => GetRandomChars(LettersAndNumbers, length, length);
private static char[] GetRandomChars(int minLength, int maxLength) => GetRandomChars(LettersAndNumbers, minLength, maxLength);
private static char[] GetRandomChars(char[] sourceChars, int minLength, int maxLength)
{
var random = new Random();
return Enumerable.Repeat(sourceChars, random.Next(minLength, maxLength)).Select(s => s[random.Next(s.Length)]).ToArray();
}
public static string NewToken()
{
return new string(GetRandomChars(AcConst.MinUserTokenLength, AcConst.MaxUserTokenLength));
}
public static string NewPassword()
{
return new string(GetRandomChars(AcConst.MinPasswordLength, AcConst.MaxPasswordLength));
}
}
}

View File

@ -43,35 +43,35 @@ public abstract class AcLogWriterBase : IAcLogWriterBase
[Conditional("DEBUG")]
public void DetailConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Detail(text, memberName, categoryName);
=> Detail(text, categoryName, memberName);
public void Debug(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Write(AppType, LogLevel.Debug, text, memberName, categoryName ?? CategoryName);
[Conditional("DEBUG")]
public void DebugConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Debug(text, memberName, categoryName);
=> Debug(text, categoryName, memberName);
public void Info(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Write(AppType, LogLevel.Info, text, memberName, categoryName ?? CategoryName);
[Conditional("DEBUG")]
public void InfoConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Info(text, memberName, categoryName);
=> Info(text, categoryName, memberName);
public void Warning(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Write(AppType, LogLevel.Warning, text, memberName, categoryName ?? CategoryName);
[Conditional("DEBUG")]
public void WarningConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Warning(text, memberName, categoryName);
=> Warning(text, categoryName, memberName);
public void Suggest(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Write(AppType, LogLevel.Suggest, text, memberName, categoryName ?? CategoryName);
[Conditional("DEBUG")]
public void SuggestConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Suggest(text, memberName, categoryName);
=> Suggest(text, categoryName, memberName);
public void Error(string? text, Exception? ex = null, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Write(AppType, LogLevel.Error, text, memberName, categoryName ?? CategoryName, ex);

View File

@ -62,7 +62,7 @@ public abstract class AcLoggerBase : IAcLoggerBase
[Conditional("DEBUG")]
public void DetailConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Detail(text, memberName, categoryName);
=> Detail(text, categoryName, memberName);
public virtual void Debug(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
{
@ -71,7 +71,7 @@ public abstract class AcLoggerBase : IAcLoggerBase
[Conditional("DEBUG")]
public void DebugConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Debug(text, memberName, categoryName);
=> Debug(text, categoryName, memberName);
public virtual void Info(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
{
@ -80,7 +80,7 @@ public abstract class AcLoggerBase : IAcLoggerBase
[Conditional("DEBUG")]
public void InfoConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Info(text, memberName, categoryName);
=> Info(text, categoryName, memberName);
public virtual void Warning(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
{
@ -89,7 +89,7 @@ public abstract class AcLoggerBase : IAcLoggerBase
[Conditional("DEBUG")]
public void WarningConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Warning(text, memberName, categoryName);
=> Warning(text, categoryName, memberName);
public virtual void Suggest(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
{
@ -98,7 +98,7 @@ public abstract class AcLoggerBase : IAcLoggerBase
[Conditional("DEBUG")]
public void SuggestConditional(string? text, string? categoryName = null, [CallerMemberName] string? memberName = null)
=> Suggest(text, memberName, categoryName);
=> Suggest(text, categoryName, memberName);
public virtual void Error(string? text, Exception? ex = null, string? categoryName = null, [CallerMemberName] string? memberName = null)
{

View File

@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -13,15 +13,15 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.Tests.Users
{
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileAddress : class, IAcAddress
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TEmailMessage : class, IAcEmailMessageBase
{
[DataTestMethod]

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -21,13 +21,13 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Database.DataLayers.Users
{
public abstract class AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDalBase<TDbContext>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDalBase<TDbContext>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -9,12 +9,12 @@ using Microsoft.EntityFrameworkCore;
namespace AyCode.Database.DbContexts.Users
{
public abstract class AcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProvider<TUser, TUserToServiceProvider>//IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompany<TUser, TUserToServiceProvider, TProfile>//IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{
@ -46,7 +46,7 @@ namespace AyCode.Database.DbContexts.Users
{
base.OnModelCreating(modelBuilder);
new AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>().Configure(modelBuilder.Entity<TUser>());
new AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>().Configure(modelBuilder.Entity<TUser>());
new AcProfileEntityTypeDefaultConfiguration<TProfile, TProfileAddress>().Configure(modelBuilder.Entity<TProfile>());
//new EmailMessageEntityTypeDefaultConfigurations().Configure(modelBuilder.Entity<EmailMessage>());

View File

@ -10,16 +10,16 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.DbContexts.Users;
public interface IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
: IAcUserDbSet<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcUserTokenDbSet<TUserToken>,
public interface IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
: IAcUserDbSet<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcUserTokenDbSet<TUserToken>,
IAcAddressDbSetBase<TProfileAddress>, IAcProfileDbSetBase<TProfile>,
IAcEmailMessageDbSet<TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -6,10 +6,10 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.DbSets.Users;
public interface IAcUserDbSet<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDbSetBase<TUser>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcUserDbSet<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDbSetBase<TUser>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{ }

View File

@ -19,10 +19,11 @@ public static class AcUserEntityTypeBuilderExtensions
modelBuilder.Navigation(e => e.Profile).AutoInclude(autoInclude).IsRequired();
}
public static void BuildEntityToServiceProviderRelation<TServiceProviderRelation, TServiceProvider, TUserToServiceProvider>(this EntityTypeBuilder<TServiceProviderRelation> modelBuilder, bool autoInclude = true)
where TServiceProviderRelation : class, IAcUserBase, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : class, IAcServiceProvider<TServiceProviderRelation, TUserToServiceProvider>
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
public static void BuildEntityToServiceProviderRelation<TCompanyRelation, TCompany, TUserToServiceProvider, TProfile>(this EntityTypeBuilder<TCompanyRelation> modelBuilder, bool autoInclude = true)
where TCompanyRelation : class, IAcUserBase, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : class, IAcCompany<TCompanyRelation, TUserToServiceProvider, TProfile>
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfile : class, IAcProfileDtoBase
{
modelBuilder
.HasMany(e => e.ServiceProviders)

View File

@ -7,17 +7,17 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AyCode.Database.ModelBuilders.Users;
public class AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcEntityTypeConfiguration<TUser>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcEntityTypeConfiguration<TUser>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProvider<TUser, TUserToServiceProvider>
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompany<TUser, TUserToServiceProvider, TProfile>
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual void Configure(EntityTypeBuilder<TUser> modelBuilder)
{
modelBuilder.BuildEntityToProfileRelation<TUser, TProfile>();
//modelBuilder.BuildEntityToAddressRelation<TProfileAddress, TProfile, TProfileAddress>();
modelBuilder.BuildEntityToServiceProviderRelation<TUser, TServiceProvider, TUserToServiceProvider>();
modelBuilder.BuildEntityToServiceProviderRelation<TUser, TCompany, TUserToServiceProvider, TProfile>();
}
}

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -1,15 +1,17 @@

using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using AyCode.Interfaces.Profiles.Dtos;
using AyCode.Interfaces.ServiceProviders;
using AyCode.Interfaces.Users;
namespace AyCode.Entities.ServiceProviders
{
[Table("ServiceProviders")]
public abstract class AcServiceProvider<TUser, TUserToServiceProvider> : IAcServiceProvider<TUser, TUserToServiceProvider>
public abstract class AcCompany<TUser, TUserToServiceProvider, TProfile> : IAcCompany<TUser, TUserToServiceProvider, TProfile>
where TUser : class, IAcUserBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfile : class, IAcProfileDtoBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
@ -17,6 +19,10 @@ namespace AyCode.Entities.ServiceProviders
[Required]
public Guid OwnerId { get; set; }
public Guid ProfileId { get; set; }
[NotMapped] //COMPANY_RENAME - J.
public TProfile Profile { get; set; }
[Required]
public string Name { get; set; }
@ -33,19 +39,19 @@ namespace AyCode.Entities.ServiceProviders
public DateTime Modified { get; set; }
protected AcServiceProvider()
protected AcCompany()
{
}
protected AcServiceProvider(string name, Guid ownerId) : this(Guid.NewGuid(), name, ownerId)
protected AcCompany(string name, Guid ownerId) : this(Guid.NewGuid(), name, ownerId)
{
}
protected AcServiceProvider(Guid id, string name, Guid ownerId) : this(id, name, ownerId, Guid.NewGuid())
protected AcCompany(Guid id, string name, Guid ownerId) : this(id, name, ownerId, Guid.NewGuid())
{
}
protected AcServiceProvider(Guid id, string name, Guid ownerId, Guid affiliateId, double? commissionPercent = null) : this()
protected AcCompany(Guid id, string name, Guid ownerId, Guid affiliateId, double? commissionPercent = null) : this()
{
Id = id;
Name = name;

View File

@ -11,10 +11,10 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Entities.Users
{
[Table("Users")]
public abstract class AcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>() : IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>() : IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
@ -39,7 +39,7 @@ namespace AyCode.Entities.Users
public virtual TProfile Profile { get; set; }
//[NotMapped]
public virtual List<TServiceProvider> ServiceProviders { get; set; }
public virtual List<TCompany> ServiceProviders { get; set; }
public virtual List<TUserToServiceProvider> UserToServiceProviders { get; set; }
public DateTime Created { get; set; }

View File

@ -6,9 +6,9 @@ using AyCode.Interfaces.Users;
namespace AyCode.Entities.Users;
[Table("UserToServiceProvider")]
public abstract class AcUserToServiceProvider<TUser, TServiceProvider> : IAcUserToAcServiceProvider<TUser, TServiceProvider>
public abstract class AcUserToCompany<TUser, TCompany> : IAcUserToCompany<TUser, TCompany>
where TUser : class, IAcUserBase
where TServiceProvider : class, IAcServiceProviderBase
where TCompany : class, IAcCompanyBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
@ -17,7 +17,8 @@ public abstract class AcUserToServiceProvider<TUser, TServiceProvider> : IAcUser
public Guid ServiceProviderId { get; set; }
public virtual TUser User { get; set; }
public virtual TServiceProvider ServiceProvider { get; set; }
[ForeignKey("ServiceProviderId")] //COMPANY_RENAME - J.
public virtual TCompany Company { get; set; }
public DateTime Created { get; set; }
public DateTime Modified { get; set; }

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -6,13 +6,13 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Server.Logins;
public interface IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginDtoBase
public interface IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginDtoBase
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
bool IsLoggedIn { get; }

View File

@ -7,14 +7,14 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Server.Logins;
public interface IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public TResultLoggedInModel? LoggedInModel { get; }

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -5,10 +5,10 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool IsLoggedIn { get; }

View File

@ -5,11 +5,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
}

View File

@ -6,11 +6,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool Logout();

View File

@ -0,0 +1,11 @@
using AyCode.Interfaces.Profiles.Dtos;
using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcCompany<TUser, TUserToServiceProvider, TProfile> : IAcCompanyBase, IAcUsersRelation<TUser, TUserToServiceProvider>, IAcProfileRelation<TProfile>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfile : IAcProfileDtoBase
{}

View File

@ -1,10 +1,11 @@

using AyCode.Interfaces.Entities;
using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderBase : IEntityGuid, ITimeStampInfo, IOwnerId
public interface IAcCompanyBase : IEntityGuid, IAcProfileForeignKey, ITimeStampInfo, IOwnerId
{
string Name { get; set; }

View File

@ -1,6 +1,6 @@
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderForeignKey
public interface IAcCompanyForeignKey
{
public Guid ServiceProviderId { get; set; }
}

View File

@ -0,0 +1,11 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
{
public List<TCompany> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
}

View File

@ -1,8 +0,0 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProvider<TUser, TUserToServiceProvider> : IAcServiceProviderBase, IAcUsersRelation<TUser, TUserToServiceProvider>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
{}

View File

@ -1,11 +0,0 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
{
public List<TServiceProvider> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
}

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.Addresses;
namespace AyCode.Interfaces.Users.Dtos;
public interface IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDtoMinBase<TProfile>, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
public interface IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDtoMinBase<TProfile>, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{
}

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Interfaces.Users.Dtos;
public interface IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserBase, IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserBase, IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{
}

View File

@ -6,9 +6,9 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Interfaces.Users;
public interface IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcProfileForeignKey
public interface IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcProfileForeignKey
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{ }

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.Users;
public interface IAcUserToAcServiceProvider<TUser, TServiceProvider> : IAcUserToServiceProviderBase
public interface IAcUserToCompany<TUser, TCompany> : IAcUserToCompanyBase
where TUser : class, IAcUserBase
where TServiceProvider : class, IAcServiceProviderBase
where TCompany : class, IAcCompanyBase
{
public TUser User { get; set; }
public TServiceProvider ServiceProvider { get; set; }
public TCompany Company { get; set; }
}

View File

@ -4,6 +4,6 @@ using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.Users;
public interface IAcUserToServiceProviderBase : IEntityGuid, IAcUserForeignKey, IAcServiceProviderForeignKey, ITimeStampInfo
public interface IAcUserToCompanyBase : IEntityGuid, IAcUserForeignKey, IAcCompanyForeignKey, ITimeStampInfo
{
}

View File

@ -2,11 +2,11 @@
namespace AyCode.Interfaces.Users;
public interface IAcUserToServiceProviderRelation<TUser, TServiceProvider, TUserToServiceProvider>
where TUser : class, IAcUserBase, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
public interface IAcUserToServiceProviderRelation<TUser, TCompany, TUserToServiceProvider>
where TUser : class, IAcUserBase, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
{
public TUser User { get; set; }
public TServiceProvider ServiceProvider { get; set; }
public TCompany ServiceProvider { get; set; }
}

View File

@ -2,7 +2,7 @@
public interface IAcUsersRelation<TUser, TUserToServiceProvider>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TUserToServiceProvider : IAcUserToCompanyBase
{
public List<TUser> Users { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -7,13 +7,13 @@ using AyCode.Interfaces.Server.Logins;
namespace AyCode.Models.Server.Logins;
public class AcLoggedInModelServer<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoggedInModelServer<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool IsLoggedIn => LoggedInUser != null;

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -7,20 +7,20 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users;
public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoMinBase<TUserDto, TProfile, TProfileDto, TProfileAddress>, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TUserDto : class, IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoMinBase<TUserDto, TProfile, TProfileDto, TProfileAddress>, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TUserDto : class, IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileDto : class, IAcProfileDtoBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public List<TServiceProvider> ServiceProviders { get; set; }
public List<TCompany> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
protected AcUserModelDtoBase() {}
protected AcUserModelDtoBase(IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> user) : base(user)
protected AcUserModelDtoBase(IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> user) : base(user)
{
Profile.AddressId = user.Profile.AddressId;
UserDto.AffiliateId = user.AffiliateId;
@ -28,15 +28,15 @@ public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TServi
//így proxy error lesz... - J.
//ServiceProviders = new List<TServiceProvider>(user.ServiceProviders);
//ServiceProviders = new List<TCompany>(user.ServiceProviders);
//UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders);
ServiceProviders = new List<TServiceProvider>(user.ServiceProviders.Count);
ServiceProviders = new List<TCompany>(user.ServiceProviders.Count);
UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders.Count);
foreach (var serviceProvider in user.ServiceProviders)
{
var newProvider = Activator.CreateInstance<TServiceProvider>();
var newProvider = Activator.CreateInstance<TCompany>();
newProvider.Id = serviceProvider.Id;
newProvider.Name = serviceProvider.Name;

View File

@ -7,16 +7,16 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users;
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoBase<TUserDtoDetail, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUserDtoDetail : class, IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserDtoDetail : class, IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileDto : class, IAcProfileDtoBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
protected AcUserModelDtoDetailBase() {}
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> user) : base(user)
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> user) : base(user)
{
UserDto.EmailAddress = user.EmailAddress;
UserDto.PhoneNumber = user.PhoneNumber;

View File

@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -15,17 +15,17 @@ using AyCode.Utils.Extensions;
namespace AyCode.Services.Server.Tests.LoginServices
{
public abstract class AcLoginServiceServerTestBase<TDal, TDbContext, TLoginServiceServer, TResultLoggedInModel, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TLoginServiceServer : class, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcLoginServiceServerTestBase<TDal, TDbContext, TLoginServiceServer, TResultLoggedInModel, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TLoginServiceServer : class, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileAddress : class, IAcAddress
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TEmailMessage : class, IAcEmailMessageBase
{
[DataTestMethod]

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>

View File

@ -29,17 +29,17 @@ using Microsoft.Extensions.Configuration;
namespace AyCode.Services.Server.Logins;
public class AcLoginServiceServer<TResultLoggedInModel, TDal, TDbContext, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>(TDal userDal, IConfiguration configuration)
: AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoginServiceServer<TResultLoggedInModel, TDal, TDbContext, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>(TDal userDal, IConfiguration configuration)
: AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel : class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel : class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -0,0 +1,13 @@
using AyCode.Services.SignalRs;
namespace AyCode.Services.Server.SignalRs;
public interface IAcSignalRHubItemServer : IAcSignalRHubBase
{
//string ConnectionId { get; set; }
//string? UserIdentifier { get; set; }
}
public interface IAcSignalRHubServer : IAcSignalRHubBase //: IAcSignalRHubBase
{
}

View File

@ -1,7 +0,0 @@
using AyCode.Services.SignalRs;
namespace AyCode.Services.Server.SignalRs;
public interface IAcSignalRHubServer : IAcSignalRHubBase
{
}

View File

@ -4,10 +4,12 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.5" />
</ItemGroup>
<ItemGroup>

View File

@ -6,11 +6,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Services.Logins;
public abstract class AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual bool IsLoggedIn => LoggedInUser != null;

View File

@ -8,13 +8,13 @@ using AyCode.Interfaces.Users;
namespace AyCode.Services.Logins;
public class AcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
: AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
: AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual TUser? Login(string email, string password, out string accessToken)

View File

@ -2,10 +2,13 @@
public interface IAcSignalRHubClient : IAcSignalRHubBase
{
Task SendMessageToServerAsync(int messageTag, object message, int? requestId );
Task SendRequestToServerAsync(int messageTag, int requestId);
}
public interface IAcSignalRHubBase
{
Task Send(string user, int messageTag, object? message);
Task MessageReceived(string user, int messageTag, byte[]? message);
Task OnRequestMessage(int messageTag, int requesrId);
Task OnReceiveMessage(int messageTag, byte[] message, int? requestId);
}

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
</Project>

View File

@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Product</Configurations>
</PropertyGroup>
<ItemGroup>