diff --git a/01-Core/Jinget.Core/Attributes/AuthenticationRequired.cs b/01-Core/Jinget.Core/Attributes/AuthenticationRequired.cs
index 7c5d2de..e9e4792 100644
--- a/01-Core/Jinget.Core/Attributes/AuthenticationRequired.cs
+++ b/01-Core/Jinget.Core/Attributes/AuthenticationRequired.cs
@@ -1,12 +1,10 @@
-using System;
+namespace Jinget.Core.Attributes;
-namespace Jinget.Core.Attributes
+///
+/// This attribute are useful in scenarios like Service Hub, where prior to calling an API we need to authenticate it
+///
+[AttributeUsage(AttributeTargets.Method)]
+public class AuthenticationRequiredAttribute(bool required) : Attribute
{
- ///
- /// This attribute are useful in scenarios like Service Hub, where prior to calling an API we need to authenticate it
- ///
- public class AuthenticationRequiredAttribute(bool required) : Attribute
- {
- public bool Required { get; set; } = required;
- }
+ public bool Required { get; set; } = required;
}
diff --git a/01-Core/Jinget.Core/Attributes/ClaimAttribute.cs b/01-Core/Jinget.Core/Attributes/ClaimAttribute.cs
index 8da2a3e..a63e38c 100644
--- a/01-Core/Jinget.Core/Attributes/ClaimAttribute.cs
+++ b/01-Core/Jinget.Core/Attributes/ClaimAttribute.cs
@@ -1,19 +1,13 @@
-using Microsoft.AspNetCore.Authorization;
+namespace Jinget.Core.Attributes;
-namespace Jinget.Core.Attributes
+///
+/// Used for assigning claims for actions
+///
+
+public class ClaimAttribute : AuthorizeAttribute
{
///
- /// Used for assigning claims for actions
+ /// Gets or sets the claim title.
///
-#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
-
- public class ClaimAttribute : AuthorizeAttribute
- {
- ///
- /// Gets or sets the claim title.
- ///
- public string Title { get; set; }
- }
-#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
-
+ public required string Title { get; set; }
}
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/Attributes/EntityAttribute.cs b/01-Core/Jinget.Core/Attributes/EntityAttribute.cs
index c44837b..2fa9ee1 100644
--- a/01-Core/Jinget.Core/Attributes/EntityAttribute.cs
+++ b/01-Core/Jinget.Core/Attributes/EntityAttribute.cs
@@ -1,16 +1,14 @@
-using System;
+namespace Jinget.Core.Attributes;
-namespace Jinget.Core.Attributes
+///
+/// Used for assigning custom configurations for entity properties
+///
+[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
+public class EntityAttribute : Attribute
{
- ///
- /// Used for assigning custom configurations for entity properties
+ ///
+ /// Gets or sets a value indicating whether the entity is used as an elastic search index or not.
///
- public class EntityAttribute : Attribute
- {
- ///
- /// Gets or sets a value indicating whether the entity is used as an elastic search index or not.
- ///
- /// true if [elastic search enabled]; otherwise, false.
- public bool ElasticSearchEnabled { get; set; }
- }
+ /// true if [elastic search enabled]; otherwise, false.
+ public bool ElasticSearchEnabled { get; set; }
}
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/Attributes/SummaryAttribute.cs b/01-Core/Jinget.Core/Attributes/SummaryAttribute.cs
index 6f10a72..54cd799 100644
--- a/01-Core/Jinget.Core/Attributes/SummaryAttribute.cs
+++ b/01-Core/Jinget.Core/Attributes/SummaryAttribute.cs
@@ -1,20 +1,18 @@
-using System;
+namespace Jinget.Core.Attributes;
-namespace Jinget.Core.Attributes
+///
+/// Manage Method Summary Attribute
+///
+///
+/// provide method summary for using in access management
+///
+///
+[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
+public class SummaryAttribute(string description) : Attribute
{
+
///
- /// Manage Method Summary Attribute
+ /// Action's description. this value will be shown to the end user
///
- ///
- /// provide method summary for using in access management
- ///
- ///
- public class SummaryAttribute(string description) : Attribute
- {
-
- ///
- /// Action's description. this value will be shown to the end user
- ///
- public string Description { get; set; } = description;
- }
+ public string Description { get; set; } = description;
}
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/Attributes/SwaggerExcludeAttribute.cs b/01-Core/Jinget.Core/Attributes/SwaggerExcludeAttribute.cs
index 48bea66..4c7181f 100644
--- a/01-Core/Jinget.Core/Attributes/SwaggerExcludeAttribute.cs
+++ b/01-Core/Jinget.Core/Attributes/SwaggerExcludeAttribute.cs
@@ -1,7 +1,4 @@
-using System;
+namespace Jinget.Core.Attributes;
-namespace Jinget.Core.Attributes
-{
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
- public class SwaggerExcludeAttribute : Attribute { }
-}
\ No newline at end of file
+[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
+public class SwaggerExcludeAttribute : Attribute { }
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/CodeDom/JingetDynamicCode.cs b/01-Core/Jinget.Core/CodeDom/JingetDynamicCode.cs
index a57dfcb..3962384 100644
--- a/01-Core/Jinget.Core/CodeDom/JingetDynamicCode.cs
+++ b/01-Core/Jinget.Core/CodeDom/JingetDynamicCode.cs
@@ -1,213 +1,196 @@
-using System;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Text;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.CSharp;
-
-namespace Jinget.Core.CodeDom
+namespace Jinget.Core.CodeDom;
+
+public sealed class JingetDynamicCode
{
- public sealed class JingetDynamicCode
+ private class Compiler
{
- private class Compiler
+ /// Compilation might be ended with some errors. The compile time errors are stored in this output parameter
+ /// During the dynamic code execution process, given sourceCode might change. Changed version of the sourceCode are stored in this output parameter
+ /// C# 9.0 enables you to write top level statements.
+ /// In order to compile the given sourceCode, some external references might needed to be added. Required references are being passed using this parameter
+ internal static byte[]? Compile(string sourceCode, MethodOptions? args, out List errors, out string jingetSource,
+ bool isTopLevelStatement = true, List? references = null)
{
- /// Compilation might be ended with some errors. The compile time errors are stored in this output parameter
- /// During the dynamic code execution process, given sourceCode might change. Changed version of the sourceCode are stored in this output parameter
- /// C# 9.0 enables you to write top level statements.
- /// In order to compile the given sourceCode, some external references might needed to be added. Required references are being passed using this parameter
- internal static byte[]? Compile(string sourceCode, MethodOptions? args, out List errors, out string jingetSource,
- bool isTopLevelStatement = true, List? references = null)
- {
- references ??= [];
- jingetSource = string.Empty;
- errors = [];
+ references ??= [];
+ jingetSource = string.Empty;
+ errors = [];
- sourceCode = sourceCode.Trim();
- sourceCode = sourceCode.StartsWith(Environment.NewLine)
- ? sourceCode.TrimStart(Environment.NewLine.ToCharArray())
- : sourceCode;
- sourceCode = sourceCode.Trim();
+ sourceCode = sourceCode.Trim();
+ sourceCode = sourceCode.StartsWith(Environment.NewLine)
+ ? sourceCode.TrimStart(Environment.NewLine.ToCharArray())
+ : sourceCode;
+ sourceCode = sourceCode.Trim();
- if (isTopLevelStatement)
- sourceCode = GenerateSourceCode(sourceCode, args);
- jingetSource = sourceCode;
+ if (isTopLevelStatement)
+ sourceCode = GenerateSourceCode(sourceCode, args);
+ jingetSource = sourceCode;
- using var peStream = new MemoryStream();
- var result = GenerateAssembly(sourceCode, references).Emit(peStream);
+ using var peStream = new MemoryStream();
+ var result = GenerateAssembly(sourceCode, references).Emit(peStream);
- if (!result.Success)
- {
- var failures = result.Diagnostics.Where(diagnostic =>
- diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error);
+ if (!result.Success)
+ {
+ var failures = result.Diagnostics.Where(diagnostic =>
+ diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error);
- errors.AddRange(failures.Select(diagnostic => $"{diagnostic.Id} {diagnostic.GetMessage()}"));
+ errors.AddRange(failures.Select(diagnostic => $"{diagnostic.Id} {diagnostic.GetMessage()}"));
- return null;
- }
+ return null;
+ }
- peStream.Seek(0, SeekOrigin.Begin);
+ peStream.Seek(0, SeekOrigin.Begin);
- return peStream.ToArray();
- }
+ return peStream.ToArray();
+ }
- ///
- /// Generaetes new dynamic dll, based on the given source code. this dll created on the fly
- ///
- static CSharpCompilation GenerateAssembly(string sourceCode, List externalReferences)
- {
- var codeString = SourceText.From(sourceCode);
- var options = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest);
+ ///
+ /// Generaetes new dynamic dll, based on the given source code. this dll created on the fly
+ ///
+ static CSharpCompilation GenerateAssembly(string sourceCode, List externalReferences)
+ {
+ var codeString = SourceText.From(sourceCode);
+ var options = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest);
- var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, options);
+ var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, options);
- externalReferences ??= [];
+ externalReferences ??= [];
- var defaultReferences = new[] { "System.Private.CoreLib", "netstandard", "System.Runtime" };
+ var defaultReferences = new[] { "System.Private.CoreLib", "netstandard", "System.Runtime" };
- externalReferences.AddRange(defaultReferences.Select(x => Assembly.Load(x).Location));
+ externalReferences.AddRange(defaultReferences.Select(x => Assembly.Load(x).Location));
- var references = new List();
- references.AddRange(externalReferences.Distinct().Select(x => MetadataReference.CreateFromFile(x)));
+ var references = new List();
+ references.AddRange(externalReferences.Distinct().Select(x => MetadataReference.CreateFromFile(x)));
- return CSharpCompilation.Create($"{Guid.NewGuid()}.dll",
- [parsedSyntaxTree],
- references: references,
- options: new CSharpCompilationOptions(
- OutputKind.DynamicallyLinkedLibrary,
- optimizationLevel: OptimizationLevel.Release,
- assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default));
- }
+ return CSharpCompilation.Create($"{Guid.NewGuid()}.dll",
+ [parsedSyntaxTree],
+ references: references,
+ options: new CSharpCompilationOptions(
+ OutputKind.DynamicallyLinkedLibrary,
+ optimizationLevel: OptimizationLevel.Release,
+ assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default));
+ }
- ///
- /// Generate source code using given expression. This method tries to put the given expression inside a method in a class
- /// so that it could be invoked
- ///
- static string GenerateSourceCode(string expression, MethodOptions? methodOptions)
- {
- CodeNamespace globalCodeNamespace = new();
- //add default using: using System;
- globalCodeNamespace.Imports.Add(new CodeNamespaceImport("System"));
+ ///
+ /// Generate source code using given expression. This method tries to put the given expression inside a method in a class
+ /// so that it could be invoked
+ ///
+ static string GenerateSourceCode(string expression, MethodOptions? methodOptions)
+ {
+ CodeNamespace globalCodeNamespace = new();
+ //add default using: using System;
+ globalCodeNamespace.Imports.Add(new CodeNamespaceImport(nameof(System)));
- if (expression.StartsWith("using "))
+ if (expression.StartsWith("using "))
+ {
+ string[] statements = expression.Split(";", StringSplitOptions.RemoveEmptyEntries);
+ foreach (var @using in statements.Where(x => x.StartsWith("using ")))
{
- string[] statements = expression.Split(";", StringSplitOptions.RemoveEmptyEntries);
- foreach (var @using in statements.Where(x => x.StartsWith("using ")))
+ string[] usingSections = @using.Split(" ", StringSplitOptions.RemoveEmptyEntries);
+ //if len>2 then using statement does not terminated with semicolon
+ if (@usingSections.Length <= 2)
{
- string[] usingSections = @using.Split(" ", StringSplitOptions.RemoveEmptyEntries);
- //if len>2 then using statement does not terminated with semicolon
- if (@usingSections.Length <= 2)
- {
- globalCodeNamespace.Imports.Add(new CodeNamespaceImport(usingSections[1]));
- expression = expression.Replace(@using, "");
- }
+ globalCodeNamespace.Imports.Add(new CodeNamespaceImport(usingSections[1]));
+ expression = expression.Replace(@using, "");
}
}
+ }
- CodeNamespace myNamespace = new("JingetDynamic");
- CodeTypeDeclaration classDeclaration = new()
- {
- IsClass = true,
- Name = "DynamicInvoker",
- TypeAttributes = TypeAttributes.NotPublic | TypeAttributes.Sealed
+ CodeNamespace myNamespace = new("JingetDynamic");
+ CodeTypeDeclaration classDeclaration = new()
+ {
+ IsClass = true,
+ Name = "DynamicInvoker",
+ TypeAttributes = TypeAttributes.NotPublic | TypeAttributes.Sealed
- };
+ };
- CodeMemberMethod myMethod = new()
- {
- Name = "DynamicInvoke",
- Attributes = MemberAttributes.Public | MemberAttributes.Final,
- ReturnType = methodOptions?.ReturnType is null ? new CodeTypeReference(typeof(void)) : new CodeTypeReference(methodOptions.ReturnType)
- };
- if (methodOptions?.Parameters != null)
- {
- myMethod.Parameters.AddRange(new CodeParameterDeclarationExpressionCollection(methodOptions
- .Parameters.Select(x => new CodeParameterDeclarationExpression(x.Type, x.Name)).ToArray()));
- }
+ CodeMemberMethod myMethod = new()
+ {
+ Name = "DynamicInvoke",
+ Attributes = MemberAttributes.Public | MemberAttributes.Final,
+ ReturnType = methodOptions?.ReturnType is null ? new CodeTypeReference(typeof(void)) : new CodeTypeReference(methodOptions.ReturnType)
+ };
+ if (methodOptions?.Parameters != null)
+ {
+ myMethod.Parameters.AddRange(new CodeParameterDeclarationExpressionCollection(methodOptions
+ .Parameters.Select(x => new CodeParameterDeclarationExpression(x.Type, x.Name)).ToArray()));
+ }
- expression = expression.Trim(';').Trim();
+ expression = expression.Trim(';').Trim();
- myMethod.Statements.Add(new CodeSnippetExpression(expression));
- classDeclaration.Members.Add(myMethod);
+ myMethod.Statements.Add(new CodeSnippetExpression(expression));
+ classDeclaration.Members.Add(myMethod);
- myNamespace.Types.Add(classDeclaration);
+ myNamespace.Types.Add(classDeclaration);
- CodeCompileUnit codeCompileUnit = new();
- codeCompileUnit.Namespaces.Add(globalCodeNamespace);
- codeCompileUnit.Namespaces.Add(myNamespace);
+ CodeCompileUnit codeCompileUnit = new();
+ codeCompileUnit.Namespaces.Add(globalCodeNamespace);
+ codeCompileUnit.Namespaces.Add(myNamespace);
- var source = new StringBuilder();
- using (var sw = new StringWriter(source))
- {
- ICodeGenerator generator = new CSharpCodeProvider().CreateGenerator(sw);
- CodeGeneratorOptions codeOpts = new();
- generator.GenerateCodeFromCompileUnit(codeCompileUnit, sw, codeOpts);
- sw.Flush();
- sw.Close();
- }
+ var source = new StringBuilder();
+ using (var sw = new StringWriter(source))
+ {
+ ICodeGenerator generator = new CSharpCodeProvider().CreateGenerator(sw);
+ CodeGeneratorOptions codeOpts = new();
+ generator.GenerateCodeFromCompileUnit(codeCompileUnit, sw, codeOpts);
+ sw.Flush();
+ sw.Close();
+ }
- //remove auto generated comments
- var marker = "//------------------------------------------------------------------------------";
- var allTheCode = source.ToString();
- var justTheRealCode = allTheCode.Substring(allTheCode.IndexOf(marker) + marker.Length, allTheCode.LastIndexOf(marker) + marker.Length);
+ //remove auto generated comments
+ var marker = "//------------------------------------------------------------------------------";
+ var allTheCode = source.ToString();
+ var justTheRealCode = allTheCode.Substring(allTheCode.IndexOf(marker) + marker.Length, allTheCode.LastIndexOf(marker) + marker.Length);
- string removedComments = allTheCode[justTheRealCode.Length..].Trim();
+ string removedComments = allTheCode[justTheRealCode.Length..].Trim();
- var removedNewLine = removedComments.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries).Where(x => !string.IsNullOrWhiteSpace(x));
- source = new StringBuilder(string.Join(Environment.NewLine, removedNewLine));
- return source.ToString();
- }
+ var removedNewLine = removedComments.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries).Where(x => !string.IsNullOrWhiteSpace(x));
+ source = new StringBuilder(string.Join(Environment.NewLine, removedNewLine));
+ return source.ToString();
}
+ }
- [MethodImpl(MethodImplOptions.NoInlining)]
- public static object? Execute(string sourceCode, out List errors, out string compiledSourceCode, MethodOptions? options = null, bool isTopLevelStatement = true, bool compileOnly = false, List? references = null)
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static object? Execute(string sourceCode, out List errors, out string compiledSourceCode, MethodOptions? options = null, bool isTopLevelStatement = true, bool compileOnly = false, List? references = null)
+ {
+ if (sourceCode.Length > 10000)
{
- if (sourceCode.Length > 10000)
- {
- throw new ArgumentException("Jinget says: sourceCode is too long. sourceCode max length is 10000 characters");
- }
+ throw new ArgumentException("Jinget says: sourceCode is too long. sourceCode max length is 10000 characters");
+ }
- var compiledCode = Compiler.Compile(sourceCode, options, out errors, out compiledSourceCode,
- isTopLevelStatement, references);
- if (compiledCode is null || compileOnly)
- {
- return null;
- }
+ var compiledCode = Compiler.Compile(sourceCode, options, out errors, out compiledSourceCode,
+ isTopLevelStatement, references);
+ if (compiledCode is null || compileOnly)
+ {
+ return null;
+ }
- var @class = Assembly.Load(compiledCode).GetTypes().FirstOrDefault(x => x.Name == "DynamicInvoker");
- var method = @class?.GetMethod("DynamicInvoke");
+ var @class = Assembly.Load(compiledCode).GetTypes().FirstOrDefault(x => x.Name == "DynamicInvoker");
+ var method = @class?.GetMethod("DynamicInvoke");
- var instance = Activator.CreateInstance(@class ?? throw new InvalidOperationException("Jinget Says: Invalid Operation"));
+ var instance = Activator.CreateInstance(@class ?? throw new InvalidOperationException("Jinget Says: Invalid Operation"));
- return method?.Invoke(instance, options?.Parameters.Select(x => x.Value).ToArray());
- }
-#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
- public class MethodOptions
+ return method?.Invoke(instance, options?.Parameters.Select(x => x.Value).ToArray());
+ }
+ public class MethodOptions
+ {
+ ///
+ /// What should be return type of the dynamically injected Invoke method?
+ /// If not set, void will be used
+ ///
+ public Type ReturnType { get; set; }
+
+ ///
+ /// What are the input parameters for dynamically injected Invoke method?
+ ///
+ public List Parameters { get; set; } = [];
+
+ public class ParameterOptions
{
- ///
- /// What should be return type of the dynamically injected Invoke method?
- /// If not set, void will be used
- ///
- public Type ReturnType { get; set; }
-
- ///
- /// What are the input parameters for dynamically injected Invoke method?
- ///
- public List Parameters { get; set; } = [];
-
- public class ParameterOptions
- {
- public Type Type { get; set; }
- public string Name { get; set; }
- public object Value { get; set; }
- }
+ public Type Type { get; set; }
+ public string Name { get; set; }
+ public object Value { get; set; }
}
-#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
}
}
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/Compiler/CompilerFeatureRequiredAttribute.cs b/01-Core/Jinget.Core/Compiler/CompilerFeatureRequiredAttribute.cs
index a1b6718..20cf141 100644
--- a/01-Core/Jinget.Core/Compiler/CompilerFeatureRequiredAttribute.cs
+++ b/01-Core/Jinget.Core/Compiler/CompilerFeatureRequiredAttribute.cs
@@ -3,8 +3,6 @@
///
/// add support for 'required' keyword using latest lang version and .net standard 2.1
///
-#pragma warning disable CA1018 // Mark attributes with AttributeUsageAttribute
public class CompilerFeatureRequiredAttribute(string name) : Attribute
-#pragma warning restore CA1018 // Mark attributes with AttributeUsageAttribute
{
}
\ No newline at end of file
diff --git a/01-Core/Jinget.Core/Contracts/IOrderBy.cs b/01-Core/Jinget.Core/Contracts/IOrderBy.cs
index a1737f8..11bee2d 100644
--- a/01-Core/Jinget.Core/Contracts/IOrderBy.cs
+++ b/01-Core/Jinget.Core/Contracts/IOrderBy.cs
@@ -1,25 +1,21 @@
-using System.Collections.Generic;
-using Jinget.Core.ExpressionToSql.Internal;
+namespace Jinget.Core.Contracts;
-namespace Jinget.Core.Contracts
+///
+/// Used for supporting sorting mechanism in elastic search query handling
+///
+///
+public interface IOrderBy
{
///
- /// Used for supporting sorting mechanism in elastic search query handling
+ /// Gets or sets the order by clause.
///
- ///
- public interface IOrderBy
- {
- ///
- /// Gets or sets the order by clause.
- ///
- /// The order by.
- T OrderBy { get; set; }
- }
+ /// The order by.
+ T OrderBy { get; set; }
+}
- ///
- /// Used for supporting sorting mechanism in dapper query handling
- ///
- public interface IOrderBy : IOrderBy>
- {
- }
+///
+/// Used for supporting sorting mechanism in dapper query handling
+///
+public interface IOrderBy : IOrderBy>
+{
}
diff --git a/01-Core/Jinget.Core/Contracts/IPaginated.cs b/01-Core/Jinget.Core/Contracts/IPaginated.cs
index 0219fbc..f0e79fd 100644
--- a/01-Core/Jinget.Core/Contracts/IPaginated.cs
+++ b/01-Core/Jinget.Core/Contracts/IPaginated.cs
@@ -1,16 +1,13 @@
-using Jinget.Core.ExpressionToSql.Internal;
+namespace Jinget.Core.Contracts;
-namespace Jinget.Core.Contracts
+///
+/// Used for supporting paging mechanism in query handling
+///
+public interface IPaginated
{
///
- /// Used for supporting paging mechanism in query handling
+ /// Gets or sets the paging configuration.
///
- public interface IPaginated
- {
- ///
- /// Gets or sets the paging configuration.
- ///
- /// The paging configuration.
- Paging PagingConfig { get; set; }
- }
+ /// The paging configuration.
+ Paging PagingConfig { get; set; }
}
diff --git a/01-Core/Jinget.Core/Contracts/IRowRestriction.cs b/01-Core/Jinget.Core/Contracts/IRowRestriction.cs
index 94bb171..06c8dee 100644
--- a/01-Core/Jinget.Core/Contracts/IRowRestriction.cs
+++ b/01-Core/Jinget.Core/Contracts/IRowRestriction.cs
@@ -1,20 +1,16 @@
-using System;
-using System.Linq.Expressions;
+namespace Jinget.Core.Contracts;
-namespace Jinget.Core.Contracts
+///
+/// Used for supporting row restriction mechanism in query handling.
+/// RowRestrictions are filters which should be automatically applied to the queries regardless of their FILTER properties.
+/// The final WHERE clause is made up: (RowRestrictions) AND (Filter)
+///
+/// The type of the t model type.
+public interface IRowRestriction
{
///
- /// Used for supporting row restriction mechanism in query handling.
- /// RowRestrictions are filters which should be automatically applied to the queries regardless of their FILTER properties.
- /// The final WHERE clause is made up: (RowRestrictions) AND (Filter)
+ /// Gets or sets the row restrictions.
///
- /// The type of the t model type.
- public interface IRowRestriction
- {
- ///
- /// Gets or sets the row restrictions.
- ///
- /// The row restrictions.
- Expression> RowRestrictions { get; set; }
- }
+ /// The row restrictions.
+ Expression> RowRestrictions { get; set; }
}
diff --git a/01-Core/Jinget.Core/Contracts/IUserContext.cs b/01-Core/Jinget.Core/Contracts/IUserContext.cs
index 21fff1c..494e10c 100644
--- a/01-Core/Jinget.Core/Contracts/IUserContext.cs
+++ b/01-Core/Jinget.Core/Contracts/IUserContext.cs
@@ -1,30 +1,26 @@
-using System.Security.Principal;
-using System.Threading.Tasks;
+namespace Jinget.Core.Contracts;
-namespace Jinget.Core.Contracts
+///
+/// Provide functionality for user context validation and management
+/// Implements the
+///
+///
+public interface IUserContext : IPrincipal
{
///
- /// Provide functionality for user context validation and management
- /// Implements the
+ /// check the access using claim attribute
///
- ///
- public interface IUserContext : IPrincipal
- {
- ///
- /// check the access using claim attribute
- ///
- /// The user identifier.
- /// Name of the sub system.
- /// Name of the API.
- /// The action title.
- /// The claim.
- Task HasAccessAsync(string userIdentifier, string subSystemName, string apiName, string actionTitle, string claim);
+ /// The user identifier.
+ /// Name of the sub system.
+ /// Name of the API.
+ /// The action title.
+ /// The claim.
+ Task HasAccessAsync(string userIdentifier, string subSystemName, string apiName, string actionTitle, string claim);
- ///
- /// Determines whether the token is valid for the given user or not.
- ///
- /// The user identifier.
- /// The token.
- Task IsTokenValidAsync(string userIdentifier, string token);
- }
+ ///
+ /// Determines whether the token is valid for the given user or not.
+ ///
+ /// The user identifier.
+ /// The token.
+ Task IsTokenValidAsync(string userIdentifier, string token);
}
diff --git a/01-Core/Jinget.Core/Enumerations/ConditionJoinType.cs b/01-Core/Jinget.Core/Enumerations/ConditionJoinType.cs
index 6f367db..5e48c1f 100644
--- a/01-Core/Jinget.Core/Enumerations/ConditionJoinType.cs
+++ b/01-Core/Jinget.Core/Enumerations/ConditionJoinType.cs
@@ -1,12 +1,11 @@
-namespace Jinget.Core.Enumerations
+namespace Jinget.Core.Enumerations;
+
+///
+/// Define Condition Join Type types which can be used in usecases such as joining filter criterias
+///
+public enum ConditionCombiningType
{
- ///
- /// Define Condition Join Type types which can be used in usecases such as joining filter criterias
- ///
- public enum ConditionCombiningType
- {
- Unknown = 0,
- AndAlso,
- OrElse
- }
+ Unknown = 0,
+ AndAlso,
+ OrElse
}
diff --git a/01-Core/Jinget.Core/Enumerations/ExceptionType.cs b/01-Core/Jinget.Core/Enumerations/ExceptionType.cs
index 0dc270b..3174795 100644
--- a/01-Core/Jinget.Core/Enumerations/ExceptionType.cs
+++ b/01-Core/Jinget.Core/Enumerations/ExceptionType.cs
@@ -1,23 +1,22 @@
-namespace Jinget.Core.Enumerations
+namespace Jinget.Core.Enumerations;
+
+///
+/// Define different exception types
+///
+public enum ExceptionType
{
///
- /// Define different exception types
+ /// Exceptions raised from the jinget internal
+ ///
+ JingetInternal,
+
+ ///
+ /// Exceptions raised from the .Net framework internal
///
- public enum ExceptionType
- {
- ///
- /// Exceptions raised from the jinget internal
- ///
- JingetInternal,
-
- ///
- /// Exceptions raised from the .Net framework internal
- ///
- DotNetInternal,
+ DotNetInternal,
- ///
- /// Custom exceptoins defined by user itself in his/her code.
- ///
- Custom
- }
+ ///
+ /// Custom exceptoins defined by user itself in his/her code.
+ ///
+ Custom
}
diff --git a/01-Core/Jinget.Core/Enumerations/Operator.cs b/01-Core/Jinget.Core/Enumerations/Operator.cs
index 564773d..7ae89e3 100644
--- a/01-Core/Jinget.Core/Enumerations/Operator.cs
+++ b/01-Core/Jinget.Core/Enumerations/Operator.cs
@@ -1,16 +1,15 @@
-namespace Jinget.Core.Enumerations
+namespace Jinget.Core.Enumerations;
+
+///
+/// Define Operator types which can be used in usecases such as filter criteria
+///
+public enum Operator
{
- ///
- /// Define Operator types which can be used in usecases such as filter criteria
- ///
- public enum Operator
- {
- Equal,
- Contains,
- GreaterThan,
- LowerThan,
- GreaterThanOrEqual,
- LowerThanOrEqual,
- NotEqual
- }
+ Equal,
+ Contains,
+ GreaterThan,
+ LowerThan,
+ GreaterThanOrEqual,
+ LowerThanOrEqual,
+ NotEqual
}
diff --git a/01-Core/Jinget.Core/Enumerations/OrderByDirection.cs b/01-Core/Jinget.Core/Enumerations/OrderByDirection.cs
index bddbc1b..5aea86f 100644
--- a/01-Core/Jinget.Core/Enumerations/OrderByDirection.cs
+++ b/01-Core/Jinget.Core/Enumerations/OrderByDirection.cs
@@ -1,18 +1,17 @@
using System.ComponentModel;
-namespace Jinget.Core.Enumerations
+namespace Jinget.Core.Enumerations;
+
+///
+/// Define order by directions used in query handling
+///
+public enum OrderByDirection
{
- ///
- /// Define order by directions used in query handling
- ///
- public enum OrderByDirection
- {
- ///
- [Description("ASC")]
- Ascending,
+ ///
+ [Description("ASC")]
+ Ascending,
- ///
- [Description("DESC")]
- Descending
- }
+ ///
+ [Description("DESC")]
+ Descending
}
diff --git a/01-Core/Jinget.Core/Exceptions/JingetException.cs b/01-Core/Jinget.Core/Exceptions/JingetException.cs
index 2bbe282..3b70386 100644
--- a/01-Core/Jinget.Core/Exceptions/JingetException.cs
+++ b/01-Core/Jinget.Core/Exceptions/JingetException.cs
@@ -1,27 +1,23 @@
-using System;
-using Jinget.Core.Enumerations;
+namespace Jinget.Core.Exceptions;
-namespace Jinget.Core.Exceptions
+///
+/// Provide a mechanism for defining custom jinget exceptions
+/// Implements the
+///
+///
+/// Exception message to be thrown
+/// The inner exception to be thrown
+/// Custom code of exception
+/// Type of exception
+public class JingetException(string message, Exception ex, int code = -1, ExceptionType type = ExceptionType.JingetInternal) : Exception(message, ex)
{
- ///
- /// Provide a mechanism for defining custom jinget exceptions
- /// Implements the
- ///
- ///
+ public int Code { get; set; } = code;
+
+ public ExceptionType Type { get; set; } = type;
+
/// Exception message to be thrown
- /// The inner exception to be thrown
/// Custom code of exception
/// Type of exception
- public class JingetException(string message, Exception ex, int code = -1, ExceptionType type = ExceptionType.JingetInternal) : Exception(message, ex)
- {
- public int Code { get; set; } = code;
-
- public ExceptionType Type { get; set; } = type;
-
- /// Exception message to be thrown
- /// Custom code of exception
- /// Type of exception
- public JingetException(string message, int code = -1, ExceptionType type = ExceptionType.JingetInternal)
- : this(message, null, code, type) { }
- }
+ public JingetException(string message, int code = -1, ExceptionType type = ExceptionType.JingetInternal)
+ : this(message, new Exception(), code, type) { }
}
diff --git a/01-Core/Jinget.Core/ExpressionToSql/Internal/OrderBy.cs b/01-Core/Jinget.Core/ExpressionToSql/Internal/OrderBy.cs
index e77fbd8..7f6ea96 100644
--- a/01-Core/Jinget.Core/ExpressionToSql/Internal/OrderBy.cs
+++ b/01-Core/Jinget.Core/ExpressionToSql/Internal/OrderBy.cs
@@ -6,52 +6,51 @@
using Jinget.Core.ExtensionMethods.Expressions;
using Jinget.Core.Utilities.Expressions;
-namespace Jinget.Core.ExpressionToSql.Internal
+namespace Jinget.Core.ExpressionToSql.Internal;
+
+///
+/// Provides the order by functionality used in query handling
+///
+#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+
+public class OrderBy
{
+ public OrderBy()
+ {
+
+ }
+ public OrderBy(string name) => Name = ExpressionUtility.ToExpression