last ...
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
public static class XDatabaseDescriptorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Validate a Database Descriptor ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XDatabaseDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
!source.IsNull() &&
|
||||
!source.Name.IsNullOrEmpty();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has EF Core Context or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasContext(this XDatabaseDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.Context.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has Repositories or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasRepositories(this XDatabaseDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.Repositories.IsNull() &&
|
||||
source.Repositories.HasChild();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Models;
|
||||
|
||||
namespace xDataService.Extensions
|
||||
{
|
||||
public static class XRepositoryDescriptorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Validate a Descriptor ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XRepositoryDescriptor source)
|
||||
{
|
||||
var result =
|
||||
!source.IsNull() &&
|
||||
!source.Key.IsNull() &&
|
||||
!source.Entity.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has Events Service or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasEvents(this XRepositoryDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.EventsService.IsNull() &&
|
||||
!source.EventsImplementation.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has EF Core Context or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasContext(this XRepositoryDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.Context.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has GraphQL Support or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasGraphSupport(this XRepositoryDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.GraphType.IsNull() &&
|
||||
!source.GraphSchema.IsNull() &&
|
||||
!source.GraphTypeKey.IsNull() &&
|
||||
!source.GraphQueryService.IsNull() &&
|
||||
!source.GraphTypeHelperService.IsNull() &&
|
||||
!source.GraphQueryImplementation.IsNull() &&
|
||||
!source.GraphTypeHelperImplementation.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has Key Generator Service or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasKeyGenerator(this XRepositoryDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.KeyGeneratorService.IsNull() &&
|
||||
!source.KeyGeneratorImplementation.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check a Descriptor Has Repository Service or not ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasRepository(this XRepositoryDescriptor source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
source.IsValid() &&
|
||||
!source.RepositoryService.IsNull() &&
|
||||
!source.RepositoryImplementation.IsNull();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user