Skip to content

myccy8/mono

Repository files navigation

tuotuo-multi-tenant

如何在 CentOS 7 上部署 Tuotuo 项目 如何在 CentOS 7 上部署 Dianan 项目 如何变成把Tuotuo变成多宿主 如何在 Centos7 上部署服务

初步方案:

参考项目: SaasKit

§ Tuotuo.Multi.Tenant

var tenant = Request.GetOwinContext().Get<TenantInstance>(Constants.OwinCurrentTenant);

另外一种可行方案:

Autofac Extras: Multitenant Application Support: nuget, doc

§ Tuotuo.Multi.Tenant.DI

当前进度: 已经实现

候选参考方案:

数据库连接原型

§ Tuotuo.Multi.Tenant.EF

采用 Entity Framework 的项目,可以使用 Multi-Tenant With Code First 中提到的方式实现

1.Context.cs.t4

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    ...
    OnModelCreatingEx(modelBuilder);

2.IACenterEntitiesEx.cs

public partial class IACenterEntities : IDbModelCacheKeyProvider
{
    public static IACenterEntities Create(string connectionString, Guid tenantId)
    {
        return new IACenterEntities(connectionString, tenantId);
    }

    internal IACenterEntities(string connectionString, Guid tenantId)
        : base(connectionString)
    {
        Database.SetInitializer<IACenterEntities>(null);
        this.SchemaName = tenantId.ToString("N");
    }

    public string SchemaName { get; private set; }

    protected void OnModelCreatingEx(DbModelBuilder modelBuilder)
    {
        if (this.SchemaName != null)
        {
            modelBuilder.HasDefaultSchema(this.SchemaName);
        }
    }

    public string CacheKey
    {
        get { return this.SchemaName; }
    }
}

3.app.config

<entityFramework>
  <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6">
  </defaultConnectionFactory>

§ MySQLTester

将 MySQL 作为单例运行,以便进行针对 MySQL 数据库的相关测试

ORM

Data Migration

发送邮件

Background

权限认证

考虑采用 OAuth2/OpenID 的方式实现

Thinktecture.IdentityServer3

Thinktecture IdentityServer3 (github)

Thinktecture IdentityModel

Thinktecture IdentityModel

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published