Skip to content
Permalink
Browse files

complete update of samples and projects to RTM.

update project.json version to 1.1.4 for RTM + MemoryCache fixes.
  • Loading branch information
rdefreitas committed Jun 29, 2016
1 parent 25c4464 commit 90d789c07c4f450d88ffc02707a0df402c89dd9b
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C3B2A3F2-5EF9-4128-8035-255A1AC1AF7B}"
ProjectSection(SolutionItems) = preProject
@@ -82,6 +82,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

ClientId = clientId,
ClientSecret = clientSecret

});
}
});
@@ -93,9 +93,9 @@
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"userSecretsId": "aspnet5-AspNetMvcAuthSample-20160229033356"
}

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1 @@
// Write your Javascript code.
@@ -4,16 +4,18 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using SaasKit.Multitenancy;

namespace AspNetMvcSample.Controllers
{
public class HomeController : Controller

public class HomeController : Controller
{
private AppTenant tenant;
private readonly AppTenant tenant;

public HomeController(AppTenant tenant)
public HomeController(ITenant<AppTenant> tenant)
{
this.tenant = tenant;
this.tenant = tenant?.Value;
}

public IActionResult Index()
@@ -88,8 +88,8 @@
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1 @@
// Write your Javascript code.
@@ -27,6 +27,7 @@
}
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"buildOptions": {
@@ -50,6 +51,7 @@
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
}
@@ -23,12 +23,13 @@
}
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
@@ -49,8 +50,8 @@
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
@@ -1,45 +1,49 @@
{
"version": "1.1.3-rc2",
"description": "Multi-tenancy support for ASP.NET Core using StructureMap.",
"authors": [ "Ben Foster" ],
"version": "1.1.4",
"description": "Multi-tenancy support for ASP.NET Core using StructureMap.",
"authors": [ "Ben Foster" ],
"packOptions": {
"authors": [ "Ben Foster" ],
"owners": [ "Ben Foster" ],
"tags": [ "Multi-tenancy", "Multi-tenant", "Saas", "StructureMap" ],
"releaseNotes": "Updated to support ASP.NET Core RC-2",
"tags": [ "Multi-tenancy", "Multitenant", "Multitenancy", "Multitenant", "Saas", "StructureMap" ],
"releaseNotes": "Updated to support ASP.NET Core RTM. Resolves an issue with MemoryCache cache dependencies.",
"projectUrl": "http://saaskit.net",
"licenseUrl": "https://github.com/saaskit/saaskit/blob/master/LICENSE.md",
"requireLicenseAcceptance": false,
"repository": {
"type": "git",
"url": "https://github.com/saaskit/saaskit/"
}
},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0",
"StructureMap.Dnx": "0.5.1-rc2-final",
"SaasKit.Multitenancy": { "target": "project" }
},
"frameworks": {
"net46": { },
"net452": { },
"net451": { },
"netstandard1.6": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-rc2-*",
"System.Collections": "4.0.11-rc2-*",
"System.Linq": "4.1.0-rc2-*",
"System.Runtime": "4.1.0-rc2-*",
"System.Threading": "4.0.11-rc2-*"
},
"imports": [
"dotnet5.4",
"portable-net45+win8"
]
}
}
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0",
"StructureMap.Dnx": "0.5.1-rc2-final",
"SaasKit.Multitenancy": { "target": "project" }
},
"frameworks": {
"net46": {},
"net452": {},
"net451": {},
"netstandard1.6": {
"dependencies": {
"Microsoft.CSharp": "4.0.1",
"System.Collections": "4.0.11",
"System.Linq": "4.1.0",
"System.Runtime": "4.1.0",
"System.Threading": "4.0.11"
},
"imports": [
"dotnet5.4",
"portable-net45+win8"
]
}
},
"buildOptions": {
"optimize": true
}
}
@@ -4,9 +4,12 @@

namespace SaasKit.Multitenancy
{
/// <summary>
using System.Diagnostics;

/// <summary>
/// Helper class that will throw exceptions when conditions are not satisfied.
/// </summary>
[DebuggerStepThrough]
public static class Ensure
{
/// <summary>
@@ -0,0 +1,7 @@
namespace SaasKit.Multitenancy
{
public interface ITenant<out TTenant>
{
TTenant Value { get; }
}
}
@@ -0,0 +1,12 @@
namespace SaasKit.Multitenancy.Internal
{
internal class Tenant<TTenant> : ITenant<TTenant>
{
public Tenant(TTenant value)
{
Value = value;
}

public TTenant Value { get; }
}
}
@@ -4,7 +4,9 @@

namespace SaasKit.Multitenancy.Internal
{
public class TenantResolutionMiddleware<TTenant>
using System;

public class TenantResolutionMiddleware<TTenant>
{
private readonly RequestDelegate next;
private readonly ILogger log;
@@ -5,7 +5,9 @@

namespace Microsoft.Extensions.DependencyInjection
{
public static class MultitenancyServiceCollectionExtensions
using SaasKit.Multitenancy.Internal;

public static class MultitenancyServiceCollectionExtensions
{
public static IServiceCollection AddMultitenancy<TTenant, TResolver>(this IServiceCollection services)
where TResolver : class, ITenantResolver<TTenant>
@@ -18,15 +20,15 @@ public static class MultitenancyServiceCollectionExtensions
// No longer registered by default as of ASP.NET Core RC2
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();

// Make Tenant and TenantContext injectable
services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenant<TTenant>());
// Make Tenant and TenantContext injectable
services.AddScoped(prov => prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenantContext<TTenant>());
services.AddScoped(prov => prov.GetService<TenantContext<TTenant>>()?.Tenant);

services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenantContext<TTenant>());
// Make ITenant injectable for handling null injection, similar to IOptions
services.AddScoped<ITenant<TTenant>>(prov => new Tenant<TTenant>(prov.GetService<TTenant>()));

// Ensure caching is available for caching resolvers
var resolverType = typeof(TResolver);
// Ensure caching is available for caching resolvers
var resolverType = typeof(TResolver);
if (typeof(MemoryCacheTenantResolver<TTenant>).IsAssignableFrom(resolverType))
{
services.AddMemoryCache();
@@ -3,7 +3,7 @@

namespace SaasKit.Multitenancy
{
public class TenantContext<TTenant> : IDisposable
public class TenantContext<TTenant> : IDisposable
{
private bool disposed;

@@ -1,46 +1,49 @@
{
"version": "1.1.3-rc2",
"description": "Multi-tenancy support for ASP.NET Core.",
"copyright": "Copyright © Ben Foster",
"packOptions": {
"authors": [ "Ben Foster" ],
"owners": [ "Ben Foster" ],
"tags": [ "Multi-tenancy", "Multi-tenant", "Saas" ],
"releaseNotes": "Updated to support ASP.NET Core RC-2",
"projectUrl": "http://saaskit.net",
"licenseUrl": "https://github.com/saaskit/saaskit/blob/master/LICENSE.md",
"repository": {
"type": "git",
"url": "https://github.com/saaskit/saaskit/"
}
},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.AspNetCore.Http": "1.0.0",
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0"
},
"frameworks": {
"net46": { },
"net452": { },
"net451": {},
"netstandard1.6": {
"dependencies": {

"Microsoft.CSharp": "4.0.1",
"System.Collections": "4.0.11",
"System.Linq": "4.1.0",
"System.Runtime": "4.1.0",
"System.Threading": "4.0.11"
},
"imports": [
"dotnet5.4",
"portable-net45+win8"
]
}
}
"version": "1.1.4",
"description": "Multi-tenancy support for ASP.NET Core.",
"copyright": "Copyright © Ben Foster",
"packOptions": {
"authors": [ "Ben Foster" ],
"owners": [ "Ben Foster" ],
"tags": [ "Multi-tenancy", "Multitenant", "Multitenancy", "Multitenant", "Saas" ],
"releaseNotes": "Updated to support ASP.NET Core RTM. Resolves an issue with MemoryCache cache dependencies.",
"projectUrl": "http://saaskit.net",
"licenseUrl": "https://github.com/saaskit/saaskit/blob/master/LICENSE.md",
"requireLicenseAcceptance": false,
"repository": {
"type": "git",
"url": "https://github.com/saaskit/saaskit/"
}
},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.AspNetCore.Http": "1.0.0",
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0"
},
"frameworks": {
"net46": {},
"net452": {},
"net451": {},
"netstandard1.6": {
"dependencies": {
"Microsoft.CSharp": "4.0.1",
"System.Collections": "4.0.11",
"System.Linq": "4.1.0",
"System.Runtime": "4.1.0",
"System.Threading": "4.0.11"
},
"imports": [
"dotnet5.4",
"portable-net45+win8"
]
}
},
"buildOptions": {
"optimize": true
}
}

0 comments on commit 90d789c

Please sign in to comment.
You can’t perform that action at this time.