Merge pull request #56 from oqtane/master

sync
This commit is contained in:
Shaun Walker 2020-10-04 10:57:24 -04:00 committed by GitHub
commit ece8f3a57e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 27 deletions

View File

@ -79,14 +79,22 @@ namespace Oqtane.Controllers
// Get the satellite assemblies
foreach (var culture in _localizationManager.GetSupportedCultures())
{
var assembliesFolderPath = Path.Combine(binFolder, culture);
if (culture == Constants.DefaultCulture)
{
continue;
}
foreach (var resourceFile in Directory.EnumerateFiles(Path.Combine(binFolder, culture)))
if(Directory.Exists(assembliesFolderPath))
{
list.Add(Path.Combine(culture, Path.GetFileNameWithoutExtension(resourceFile)));
foreach (var resourceFile in Directory.EnumerateFiles(assembliesFolderPath))
{
list.Add(Path.Combine(culture, Path.GetFileNameWithoutExtension(resourceFile)));
}
}
else
{
Console.WriteLine($"The satellite assemblies folder named '{culture}' is not found.");
}
}

View File

@ -15,10 +15,10 @@ namespace Microsoft.Extensions.DependencyInjection
{
public static class OqtaneServiceCollectionExtensions
{
public static IServiceCollection AddOqtane(this IServiceCollection services, Runtime runtime)
public static IServiceCollection AddOqtane(this IServiceCollection services, Runtime runtime, string[] supportedCultures)
{
LoadAssemblies();
LoadSatelliteAssemblies();
LoadSatelliteAssemblies(supportedCultures);
services.AddOqtaneServices(runtime);
return services;
@ -122,7 +122,7 @@ namespace Microsoft.Extensions.DependencyInjection
}
}
private static void LoadSatelliteAssemblies()
private static void LoadSatelliteAssemblies(string[] supportedCultures)
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var assemblyPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
@ -133,17 +133,16 @@ namespace Microsoft.Extensions.DependencyInjection
AssemblyLoadContext.Default.Resolving += ResolveDependencies;
using (var serviceScope = ServiceActivator.GetScope())
foreach (var culture in supportedCultures)
{
var localizationManager = serviceScope.ServiceProvider.GetService<ILocalizationManager>();
foreach (var culture in localizationManager.GetSupportedCultures())
if (culture == Constants.DefaultCulture)
{
if (culture == Constants.DefaultCulture)
{
continue;
}
continue;
}
var assembliesFolder = new DirectoryInfo(Path.Combine(assemblyPath, culture));
var assembliesFolder = new DirectoryInfo(Path.Combine(assemblyPath, culture));
if (assembliesFolder.Exists)
{
foreach (var assemblyFile in assembliesFolder.EnumerateFiles(Constants.StalliteAssemblyExtension))
{
AssemblyName assemblyName;
@ -168,6 +167,10 @@ namespace Microsoft.Extensions.DependencyInjection
}
}
}
else
{
Console.WriteLine($"The satellite assemblies folder named '{culture}' is not found.");
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Net.Http;
@ -26,11 +27,14 @@ namespace Oqtane
{
public class Startup
{
public IConfigurationRoot Configuration { get; }
private static readonly string[] DefaultSupportedCultures = new[] { Constants.DefaultCulture };
private string _webRoot;
private Runtime _runtime;
private bool _useSwagger;
public IConfigurationRoot Configuration { get; }
public Startup(IWebHostEnvironment env)
{
var builder = new ConfigurationBuilder()
@ -128,7 +132,10 @@ namespace Oqtane
.AddSignInManager()
.AddDefaultTokenProviders();
services.Configure<LocalizationOptions>(Configuration.GetSection("Localization"));
var localizationSection = Configuration.GetSection("Localization");
var localizationOptions = localizationSection.Get<LocalizationOptions>();
services.Configure<LocalizationOptions>(localizationSection);
services.Configure<IdentityOptions>(options =>
{
@ -202,11 +209,11 @@ namespace Oqtane
services.AddTransient<ISqlRepository, SqlRepository>();
services.AddTransient<IUpgradeManager, UpgradeManager>();
// TODO: Check if there's a better way instead of building service provider
ServiceActivator.Configure(services.BuildServiceProvider());
// load the external assemblies into the app domain, install services
services.AddOqtane(_runtime);
services.AddOqtane(_runtime,
localizationOptions.SupportedCultures.IsNullOrEmpty()
? DefaultSupportedCultures
: localizationOptions.SupportedCultures);
services.AddMvc()
.AddNewtonsoftJson()

View File

@ -38,15 +38,10 @@ Please note that this project is owned by the .NET Foundation and is governed by
# Roadmap
This project is a work in progress and the schedule for implementing enhancements is dependent upon the availability of community members who are willing/able to assist.
V.Next ( still in the process of being prioritized )
- [ ] Admin UI markup optimization
- [ ] DB Migrations for framework installation/upgrade
- [ ] Support for SQLite
V.2.0.0 ( estimated release date Nov 10, 2020 )
- [ ] Migrate to .NET 5
- [ ] Static Localization ( ie. labels, help text, etc.. )
- [ ] Migrate to Code-Behind Pattern ( *.razor.cs )
- [ ] Generic Repository Pattern
- [ ] JwT token authentication ( possibly using IdentityServer )
- [ ] Optional Encryption for Settings Values
- [ ] Admin UI markup optimization
V1.0.0 (MVP) - Released in conjunction with .NET Core 3.2 ( May 2020 )
- [x] Multi-Tenant ( Shared Database & Isolated Database )
@ -66,6 +61,13 @@ V1.0.0 (MVP) - Released in conjunction with .NET Core 3.2 ( May 2020 )
- [x] Auto-Upgrade Framework
- [x] Progressive Web Application Support
Future Consideration
- [ ] DB Migrations for framework installation/upgrade
- [ ] Support for SQLite
- [ ] Generic Repository Pattern
- [ ] JwT token authentication ( possibly using IdentityServer )
- [ ] Optional Encryption for Settings Values
# Background
Oqtane was created by [Shaun Walker](https://www.linkedin.com/in/shaunbrucewalker/) and is inspired by the DotNetNuke web application framework. Initially created as a proof of concept, Oqtane is a native Blazor application written from the ground up using modern .NET Core technology. It is a modular application framework offering a fully dynamic page compositing model, multi-site support, designer friendly templates (skins), and extensibility via third party modules.