Skip to content

Commit

Permalink
TenantContext Properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorin Simionescu committed Apr 2, 2024
1 parent 027aa46 commit eea2f84
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
// Copyright (c) TotalSoft.
// This source code is licensed under the MIT license.

using System.Collections.Generic;

namespace NBB.MultiTenancy.Abstractions.Context
{
public class TenantContext
{
public Tenant Tenant { get; }

public Dictionary<string, object> Properties { get; set; } = [];
public TenantContext(Tenant tenant)
{
Tenant = tenant;
}

public TenantContext(Tenant tenant, Dictionary<string, object> properties)
{
Tenant = tenant;
Properties = properties;
}

public TenantContext Clone()
{
return new TenantContext(new Tenant(Tenant.TenantId, Tenant.Code));
return new TenantContext(new Tenant(Tenant.TenantId, Tenant.Code), new Dictionary<string, object>(Properties));
}
}
}

0 comments on commit eea2f84

Please sign in to comment.