infra du badge paramêtre manquant
This commit is contained in:
parent
cc59db24b0
commit
042b26c2e6
15 changed files with 104 additions and 26 deletions
|
|
@ -18,8 +18,10 @@ namespace Yavsc
|
|||
{
|
||||
private Client GetApplication(string clientId)
|
||||
{
|
||||
var dbContext = new ApplicationDbContext();
|
||||
var app = dbContext.Applications.FirstOrDefault(x => x.Id == clientId);
|
||||
Client app=null;
|
||||
using (var dbContext = new ApplicationDbContext()) {
|
||||
app = dbContext.Applications.FirstOrDefault(x => x.Id == clientId);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
private readonly ConcurrentDictionary<string, string> _authenticationCodes = new ConcurrentDictionary<string, string>(StringComparer.Ordinal);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yavsc.Models;
|
||||
using YavscLib;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
|
|
@ -10,15 +15,16 @@ namespace Yavsc
|
|||
/// Lists Available user profile classes,
|
||||
/// populated at startup, using reflexion.
|
||||
/// </summary>
|
||||
public static Dictionary<string,Type> ProfileTypes = new Dictionary<string,Type>() ;
|
||||
|
||||
public static List<Type> ProfileTypes = new List<Type>() ;
|
||||
public static List<PropertyInfo> UserSettings = new List<PropertyInfo> ();
|
||||
|
||||
/// <summary>
|
||||
/// Lists available command forms.
|
||||
/// This is hard coded.
|
||||
/// </summary>
|
||||
public static readonly string [] Forms = new string [] { "Profiles" , "HairCut" };
|
||||
|
||||
private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings)
|
||||
private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings, ILogger logger)
|
||||
{
|
||||
System.AppDomain.CurrentDomain.ResourceResolve += OnYavscResourceResolve;
|
||||
|
||||
|
|
@ -26,10 +32,32 @@ namespace Yavsc
|
|||
foreach (var c in a.GetTypes()) {
|
||||
if (c.IsClass && !c.IsAbstract &&
|
||||
c.GetInterface("ISpecializationSettings")!=null) {
|
||||
ProfileTypes.Add(c.FullName,c);
|
||||
ProfileTypes.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var propinfo in typeof(ApplicationDbContext).GetProperties()) {
|
||||
foreach (var attr in propinfo.CustomAttributes) {
|
||||
if (attr.AttributeType.FullName == "Yavsc.Attributes.ActivitySettingAttribute") {
|
||||
// bingo
|
||||
if (typeof(IQueryable<ISpecializationSettings>).IsAssignableFrom(propinfo.PropertyType))
|
||||
{
|
||||
logger.LogInformation($"Paramêtres utilisateur déclaré: {propinfo.Name}");
|
||||
UserSettings.Add(propinfo);
|
||||
|
||||
} else
|
||||
// Design time error
|
||||
{
|
||||
logger.LogCritical(
|
||||
$@"la propriété {propinfo.Name} du contexte de la
|
||||
base de donnée déclare être un refuge de paramêtre utilisateur
|
||||
du workflow, mais l'implemente pas l'interface IQueryable<ISpecializationSettings>,
|
||||
Elle est du type {propinfo.MemberType.GetType()}");
|
||||
throw new NotSupportedException("invalid ActivitySettingAttribute on property from dbcontext");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static System.Reflection.Assembly OnYavscResourceResolve (object sender, ResolveEventArgs ev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ namespace Yavsc
|
|||
ConfigureOAuthApp(app, SiteSetup);
|
||||
ConfigureFileServerApp(app, SiteSetup, env, authorizationService);
|
||||
ConfigureWebSocketsApp(app, SiteSetup, env);
|
||||
ConfigureWorkflow(app, SiteSetup);
|
||||
ConfigureWorkflow(app, SiteSetup, logger);
|
||||
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture) new RequestCulture((string)"fr"));
|
||||
app.UseSession();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue