diff --git a/src/ExtCore.Data.Abstractions/ExtCore.Data.Abstractions.csproj b/src/ExtCore.Data.Abstractions/ExtCore.Data.Abstractions.csproj index 022d63f..61eff78 100644 --- a/src/ExtCore.Data.Abstractions/ExtCore.Data.Abstractions.csproj +++ b/src/ExtCore.Data.Abstractions/ExtCore.Data.Abstractions.csproj @@ -1,15 +1,11 @@ - + - Dmitry Sikorsky - Copyright © 2015 Dmitry Sikorsky - The ExtCore.Data extension component. Based on the ExtCore framework. - 6.0.0 - netstandard2.0 - ExtCore.Data.Abstractions - ExtCore.Data.Abstractions - http://extcore.net/extcore_nuget_icon.png - http://extcore.net/ + net5.0 + + + + diff --git a/src/ExtCore.Data.Abstractions/IRepository.cs b/src/ExtCore.Data.Abstractions/IRepository.cs index aa65ad8..6171510 100644 --- a/src/ExtCore.Data.Abstractions/IRepository.cs +++ b/src/ExtCore.Data.Abstractions/IRepository.cs @@ -1,6 +1,9 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Benriya.Share.Abstractions; +using MapsterMapper; + namespace ExtCore.Data.Abstractions { /// @@ -12,6 +15,6 @@ public interface IRepository /// Sets the storage context to work with. /// /// The storage context to set. - void SetStorageContext(IStorageContext storageContext); + void SetStorageContext(IStorageContext storageContext,IRequestServices client); } } \ No newline at end of file diff --git a/src/ExtCore.Data.Abstractions/IStorage.cs b/src/ExtCore.Data.Abstractions/IStorage.cs index a5bd713..b398ec8 100644 --- a/src/ExtCore.Data.Abstractions/IStorage.cs +++ b/src/ExtCore.Data.Abstractions/IStorage.cs @@ -1,6 +1,7 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Benriya.Share.Abstractions; using System.Threading.Tasks; namespace ExtCore.Data.Abstractions @@ -12,11 +13,11 @@ namespace ExtCore.Data.Abstractions /// public interface IStorage { + IRequestServices Client { get; } /// /// Gets the underlying storage context used by this storage. /// IStorageContext StorageContext { get; } - /// /// Gets a repository of the given type. /// diff --git a/src/ExtCore.Data.Dapper/ExtCore.Data.Dapper.csproj b/src/ExtCore.Data.Dapper/ExtCore.Data.Dapper.csproj index 7455c47..867a921 100644 --- a/src/ExtCore.Data.Dapper/ExtCore.Data.Dapper.csproj +++ b/src/ExtCore.Data.Dapper/ExtCore.Data.Dapper.csproj @@ -17,6 +17,7 @@ + diff --git a/src/ExtCore.Data.Dapper/RepositoryBase.cs b/src/ExtCore.Data.Dapper/RepositoryBase.cs index ff57599..5b6c21a 100644 --- a/src/ExtCore.Data.Dapper/RepositoryBase.cs +++ b/src/ExtCore.Data.Dapper/RepositoryBase.cs @@ -1,6 +1,7 @@ // Copyright © 2017 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Benriya.Share.Abstractions; using ExtCore.Data.Abstractions; using ExtCore.Data.Entities.Abstractions; @@ -14,15 +15,17 @@ public abstract class RepositoryBase : IRepository where TEntity : clas { protected IStorageContext storageContext; protected string connectionString; + protected IRequestServices Client; /// /// Sets the Dapper storage context that represents the physical storage to work with. /// /// The Dapper storage context to set. - public void SetStorageContext(IStorageContext storageContext) + public void SetStorageContext(IStorageContext storageContext,IRequestServices client) { this.storageContext = storageContext; this.connectionString = (storageContext as StorageContextBase).ConnectionString; - } + this.Client = client; +} } } \ No newline at end of file diff --git a/src/ExtCore.Data.Dapper/Storage.cs b/src/ExtCore.Data.Dapper/Storage.cs index 37fbab3..94e241e 100644 --- a/src/ExtCore.Data.Dapper/Storage.cs +++ b/src/ExtCore.Data.Dapper/Storage.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; +using Benriya.Share.Abstractions; using ExtCore.Data.Abstractions; using ExtCore.Infrastructure; @@ -14,27 +15,29 @@ namespace ExtCore.Data.Dapper /// public class Storage : IStorage { + public IRequestServices Client { get; private set; } /// /// Gets the Dapper storage context. /// public IStorageContext StorageContext { get; private set; } - public Storage(IStorageContext storageContext) - { - this.StorageContext = storageContext; - } - - /// - /// Gets a repository of the given type. - /// - /// The type parameter to find implementation of. - /// - public TRepository GetRepository() where TRepository : IRepository + public Storage(IStorageContext storageContext, IRequestServices client) + { + this.StorageContext = storageContext; + this.Client = client; + } + + /// + /// Gets a repository of the given type. + /// + /// The type parameter to find implementation of. + /// + public TRepository GetRepository() where TRepository : IRepository { TRepository repository = ExtensionManager.GetInstance(); if (repository != null) - repository.SetStorageContext(this.StorageContext); + repository.SetStorageContext(this.StorageContext,this.Client); return repository; } @@ -51,6 +54,7 @@ public void Save() /// public async Task SaveAsync() { + await Task.Run(() => { return; }); } } } \ No newline at end of file diff --git a/src/ExtCore.Data.EntityFramework/ExtCore.Data.EntityFramework.csproj b/src/ExtCore.Data.EntityFramework/ExtCore.Data.EntityFramework.csproj index 0a90351..16a95c5 100644 --- a/src/ExtCore.Data.EntityFramework/ExtCore.Data.EntityFramework.csproj +++ b/src/ExtCore.Data.EntityFramework/ExtCore.Data.EntityFramework.csproj @@ -17,6 +17,7 @@ + diff --git a/src/ExtCore.Data.EntityFramework/RepositoryBase.cs b/src/ExtCore.Data.EntityFramework/RepositoryBase.cs index 1a022c1..daf9cd2 100644 --- a/src/ExtCore.Data.EntityFramework/RepositoryBase.cs +++ b/src/ExtCore.Data.EntityFramework/RepositoryBase.cs @@ -1,6 +1,7 @@ // Copyright © 2017 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Benriya.Share.Abstractions; using ExtCore.Data.Abstractions; using ExtCore.Data.Entities.Abstractions; using Microsoft.EntityFrameworkCore; @@ -15,15 +16,17 @@ public abstract class RepositoryBase : IRepository where TEntity : clas { protected DbContext storageContext; protected DbSet dbSet; + protected IRequestServices Client; /// /// Sets the Entity Framework storage context that represents the physical storage to work with. /// /// The Entity Framework storage context to set. - public void SetStorageContext(IStorageContext storageContext) + public void SetStorageContext(IStorageContext storageContext,IRequestServices client) { this.storageContext = storageContext as DbContext; this.dbSet = this.storageContext.Set(); + this.Client = client; } } } \ No newline at end of file diff --git a/src/ExtCore.Data.EntityFramework/Storage.cs b/src/ExtCore.Data.EntityFramework/Storage.cs index eedae26..51a60b0 100644 --- a/src/ExtCore.Data.EntityFramework/Storage.cs +++ b/src/ExtCore.Data.EntityFramework/Storage.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; +using Benriya.Share.Abstractions; using ExtCore.Data.Abstractions; using ExtCore.Infrastructure; using Microsoft.EntityFrameworkCore; @@ -16,17 +17,19 @@ namespace ExtCore.Data.EntityFramework /// public class Storage : IStorage { - /// - /// Gets the Entity Framework storage context. - /// - public IStorageContext StorageContext { get; private set; } + public IRequestServices Client { get; private set; } + /// + /// Gets the Entity Framework storage context. + /// + public IStorageContext StorageContext { get; private set; } - public Storage(IStorageContext storageContext) + public Storage(IStorageContext storageContext,IRequestServices client) { if (!(storageContext is DbContext)) throw new ArgumentException("The storageContext object must be an instance of the Microsoft.EntityFrameworkCore.DbContext class."); this.StorageContext = storageContext; + this.Client = client; } /// @@ -39,7 +42,7 @@ public TRepository GetRepository() where TRepository : IRepository TRepository repository = ExtensionManager.GetInstance(); if (repository != null) - repository.SetStorageContext(this.StorageContext); + repository.SetStorageContext(this.StorageContext,this.Client); return repository; } diff --git a/src/ExtCore.Infrastructure/ExtensionBase.cs b/src/ExtCore.Infrastructure/ExtensionBase.cs index 4b92b94..112e295 100644 --- a/src/ExtCore.Infrastructure/ExtensionBase.cs +++ b/src/ExtCore.Infrastructure/ExtensionBase.cs @@ -32,5 +32,14 @@ public abstract class ExtensionBase : IExtension /// Gets the authors of the extension (separated by commas). /// public virtual string Authors => null; - } + /// + /// Gets the heplper of the extension. + /// + public virtual string Helper => null; + + /// + /// Gets the policy name of the extension. + /// + public virtual string Code => null; + } } \ No newline at end of file diff --git a/src/ExtCore.Infrastructure/IExtension.cs b/src/ExtCore.Infrastructure/IExtension.cs index 96d6bc8..43fb6ad 100644 --- a/src/ExtCore.Infrastructure/IExtension.cs +++ b/src/ExtCore.Infrastructure/IExtension.cs @@ -32,5 +32,15 @@ public interface IExtension /// Gets the authors of the extension (separated by commas). /// string Authors { get; } - } + + /// + /// Gets the heplper of the extension. + /// + string Helper { get; } + + /// + /// Gets the policy code of the extension. + /// + string Code { get; } + } } \ No newline at end of file