A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/6e8aac61d19d8c15ff225fce6e6e105767643f4a below:

many changes to support · signumsoftware/framework@6e8aac6 · GitHub

@@ -42,10 +42,13 @@ public static object GetCurrentValidCulture()

42 42

t.IsEnum && !t.Name.EndsWith("Query") && !t.Name.EndsWith("Message"))

43 43

.ToDictionaryEx(GetTypeName, "Types"));

44 44 45 -

public static void RegisterLike(Type type)

45 +

public static Dictionary<string, Func<bool>> OverrideIsNamespaceAllowed = new Dictionary<string, Func<bool>>();

46 + 47 +

public static void RegisterLike(Type type, Func<bool> allowed)

46 48

{

47 49

TypesByName.Reset();

48 50

EntityAssemblies.GetOrCreate(type.Assembly).Add(type.Namespace!);

51 +

OverrideIsNamespaceAllowed[type.Namespace!] = allowed;

49 52

}

50 53 51 54

internal static void Start()

@@ -64,54 +67,68 @@ internal static void Start()

64 67

const BindingFlags instanceFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;

65 68

const BindingFlags staticFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly;

66 69 67 -

public static event Action<TypeInfoTS, Type>? AddTypeExtension;

68 -

static TypeInfoTS OnAddTypeExtension(TypeInfoTS ti, Type t)

70 +

public static event Func<TypeInfoTS, Type, TypeInfoTS?>? TypeExtension;

71 +

static TypeInfoTS? OnTypeExtension(TypeInfoTS ti, Type t)

69 72

{

70 -

foreach (var a in AddTypeExtension.GetInvocationListTyped())

71 -

a(ti, t);

73 +

foreach (var a in TypeExtension.GetInvocationListTyped())

74 +

{

75 +

ti = a(ti, t)!;

76 +

if (ti == null)

77 +

return null;

78 +

}

72 79 73 80

return ti;

74 81

}

75 82 76 -

public static event Action<MemberInfoTS, PropertyRoute>? AddPropertyRouteExtension;

77 -

static MemberInfoTS OnAddPropertyRouteExtension(MemberInfoTS mi, PropertyRoute m)

83 +

public static event Func<MemberInfoTS, PropertyRoute, MemberInfoTS?>? PropertyRouteExtension;

84 +

static MemberInfoTS? OnPropertyRouteExtension(MemberInfoTS mi, PropertyRoute m)

78 85

{

79 -

if (AddPropertyRouteExtension == null)

86 +

if (PropertyRouteExtension == null)

80 87

return mi;

81 88 82 -

foreach (var a in AddPropertyRouteExtension.GetInvocationListTyped())

83 -

a(mi, m);

89 +

foreach (var a in PropertyRouteExtension.GetInvocationListTyped())

90 +

{

91 +

mi = a(mi, m)!;

92 +

if (mi == null)

93 +

return null;

94 +

}

84 95 85 96

return mi;

86 97

}

87 98 88 99 89 -

public static event Action<MemberInfoTS, FieldInfo>? AddFieldInfoExtension;

90 -

static MemberInfoTS OnAddFieldInfoExtension(MemberInfoTS mi, FieldInfo m)

100 +

public static event Func<MemberInfoTS, FieldInfo, MemberInfoTS?>? FieldInfoExtension;

101 +

static MemberInfoTS? OnFieldInfoExtension(MemberInfoTS mi, FieldInfo m)

91 102

{

92 -

if (AddFieldInfoExtension == null)

103 +

if (FieldInfoExtension == null)

93 104

return mi;

94 105 95 -

foreach (var a in AddFieldInfoExtension.GetInvocationListTyped())

96 -

a(mi, m);

106 +

foreach (var a in FieldInfoExtension.GetInvocationListTyped())

107 +

{

108 +

mi = a(mi, m)!;

109 +

if (mi == null)

110 +

return null;

111 +

}

97 112 98 113

return mi;

99 114

}

100 115 101 -

public static event Action<OperationInfoTS, OperationInfo, Type>? AddOperationExtension;

102 -

static OperationInfoTS OnAddOperationExtension(OperationInfoTS oi, OperationInfo o, Type type)

116 +

public static event Func<OperationInfoTS, OperationInfo, Type, OperationInfoTS?>? OperationExtension;

117 +

static OperationInfoTS? OnOperationExtension(OperationInfoTS oi, OperationInfo o, Type type)

103 118

{

104 -

if (AddOperationExtension == null)

119 +

if (OperationExtension == null)

105 120

return oi;

106 121 107 -

foreach (var a in AddOperationExtension.GetInvocationListTyped())

108 -

a(oi, o, type);

122 +

foreach (var a in OperationExtension.GetInvocationListTyped())

123 +

{

124 +

oi = a(oi, o, type)!;

125 +

if (oi == null)

126 +

return null;

127 +

}

109 128 110 129

return oi;

111 130

}

112 131 113 - 114 - 115 132

public static HashSet<Type> ExcludeTypes = new HashSet<Type>();

116 133 117 134

internal static Dictionary<string, TypeInfoTS> GetTypeInfoTS()

@@ -167,7 +184,7 @@ where typeof(ModelEntity).IsAssignableFrom(type) && !type.IsAbstract

167 184

where !type.IsEnumEntity() && !ReflectionServer.ExcludeTypes.Contains(type)

168 185

let descOptions = LocalizedAssembly.GetDescriptionOptions(type)

169 186

let allOperations = !type.IsEntity() ? null : OperationLogic.GetAllOperationInfos(type)

170 -

select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

187 +

select KeyValuePair.Create(GetTypeName(type), OnTypeExtension(new TypeInfoTS

171 188

{

172 189

Kind = KindOfType.Entity,

173 190

FullName = type.FullName!,

@@ -182,7 +199,7 @@ select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

182 199

QueryDefined = queries.QueryDefined(type),

183 200

Members = PropertyRoute.GenerateRoutes(type)

184 201

.Where(pr => InTypeScript(pr))

185 -

.ToDictionary(p => p.PropertyString(), p =>

202 +

.Select(p =>

186 203

{

187 204

var validators = Validator.TryGetPropertyValidator(p)?.Validators;

188 205

@@ -196,19 +213,24 @@ select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

196 213

Unit = UnitAttribute.GetTranslation(p.PropertyInfo?.GetCustomAttribute<UnitAttribute>()?.UnitName),

197 214

Type = new TypeReferenceTS(IsId(p) ? PrimaryKey.Type(type).Nullify() : p.PropertyInfo!.PropertyType, p.Type.IsMList() ? p.Add("Item").TryGetImplementations() : p.TryGetImplementations()),

198 215

IsMultiline = validators?.OfType<StringLengthValidatorAttribute>().FirstOrDefault()?.MultiLine ?? false,

199 -

IsVirtualMList = p.IsVirtualMList(),

216 +

IsVirtualMList = p.IsVirtualMList(),

200 217

MaxLength = validators?.OfType<StringLengthValidatorAttribute>().FirstOrDefault()?.Max.DefaultToNull(-1),

201 218

PreserveOrder = settings.FieldAttributes(p)?.OfType<PreserveOrderAttribute>().Any() ?? false,

202 219

};

203 220 204 -

return OnAddPropertyRouteExtension(mi, p);

205 -

}),

221 +

return KeyValuePair.Create(p.PropertyString(), OnPropertyRouteExtension(mi, p)!);

222 +

})

223 +

.Where(kvp => kvp.Value != null)

224 +

.ToDictionaryEx("properties"),

206 225 207 -

Operations = allOperations == null ? null : allOperations.ToDictionary(oi => oi.OperationSymbol.Key, oi => OnAddOperationExtension(new OperationInfoTS(oi), oi, type)),

226 +

HasConstructorOperation = allOperations != null && allOperations.Any(oi => oi.OperationType == OperationType.Constructor),

227 +

Operations = allOperations == null ? null : allOperations.Select(oi => KeyValuePair.Create(oi.OperationSymbol.Key, OnOperationExtension(new OperationInfoTS(oi), oi, type)!)).Where(kvp => kvp.Value != null).ToDictionaryEx("operations"),

208 228 209 229

RequiresEntityPack = allOperations != null && allOperations.Any(oi => oi.HasCanExecute != null),

210 230 211 -

}, type))).ToDictionaryEx("entities");

231 +

}, type)))

232 +

.Where(kvp => kvp.Value != null)

233 +

.ToDictionaryEx("entities");

212 234 213 235

return result;

214 236

}

@@ -248,19 +270,23 @@ where type.IsEnum

248 270

where descOptions != DescriptionOptions.None

249 271

let kind = type.Name.EndsWith("Query") ? KindOfType.Query :

250 272

type.Name.EndsWith("Message") ? KindOfType.Message : KindOfType.Enum

251 -

select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

273 +

select KeyValuePair.Create(GetTypeName(type), OnTypeExtension(new TypeInfoTS

252 274

{

253 275

Kind = kind,

254 276

FullName = type.FullName!,

255 277

NiceName = descOptions.HasFlag(DescriptionOptions.Description) ? type.NiceName() : null,

256 278

Members = type.GetFields(staticFlags)

257 279

.Where(fi => kind != KindOfType.Query || queries.QueryDefined(fi.GetValue(null)!))

258 -

.ToDictionary(fi => fi.Name, fi => OnAddFieldInfoExtension(new MemberInfoTS

280 +

.Select(fi => KeyValuePair.Create(fi.Name, OnFieldInfoExtension(new MemberInfoTS

259 281

{

260 282

NiceName = fi.NiceName(),

261 283

IsIgnoredEnum = kind == KindOfType.Enum && fi.HasAttribute<IgnoreAttribute>()

262 -

}, fi)),

263 -

}, type))).ToDictionaryEx("enums");

284 +

}, fi)!))

285 +

.Where(a=>a.Value != null)

286 +

.ToDictionaryEx("query"),

287 +

}, type)))

288 +

.Where(a => a.Value != null)

289 +

.ToDictionaryEx("enums");

264 290 265 291

return result;

266 292

}

@@ -271,7 +297,7 @@ public static Dictionary<string, TypeInfoTS> GetSymbolContainers(IEnumerable<Typ

271 297 272 298

var result = (from type in allTypes

273 299

where type.IsStaticClass() && type.HasAttribute<AutoInitAttribute>()

274 -

select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

300 +

select KeyValuePair.Create(GetTypeName(type), OnTypeExtension(new TypeInfoTS

275 301

{

276 302

Kind = KindOfType.SymbolContainer,

277 303

FullName = type.FullName!,

@@ -280,13 +306,15 @@ select KeyValuePair.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS

280 306

.Where(s =>

281 307

s.FieldInfo != null && /*Duplicated like in Dynamic*/

282 308

s.IdOrNull.HasValue /*Not registered*/)

283 -

.ToDictionary(s => s.FieldInfo.Name, s => OnAddFieldInfoExtension(new MemberInfoTS

309 +

.Select(s => KeyValuePair.Create(s.FieldInfo.Name, OnFieldInfoExtension(new MemberInfoTS

284 310

{

285 311

NiceName = s.FieldInfo.NiceName(),

286 312

Id = s.IdOrNull!.Value.Object

287 -

}, s.FieldInfo))

313 +

}, s.FieldInfo)!))

314 +

.Where(a => a.Value != null)

315 +

.ToDictionaryEx("fields"),

288 316

}, type)))

289 -

.Where(a => a.Value.Members.Any())

317 +

.Where(a => a.Value != null && a.Value.Members.Any())

290 318

.ToDictionaryEx("symbols");

291 319 292 320

return result;

@@ -340,9 +368,11 @@ public class TypeInfoTS

340 368

[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "toStringFunction")]

341 369

public string? ToStringFunction { get; set; }

342 370

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, PropertyName = "queryDefined")]

343 -

public bool QueryDefined { get; internal set; }

371 +

public bool QueryDefined { get; set; }

344 372

[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "members")]

345 373

public Dictionary<string, MemberInfoTS> Members { get; set; } = null!;

374 +

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, PropertyName = "hasConstructorOperation")]

375 +

public bool HasConstructorOperation { get; set; }

346 376

[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "operations")]

347 377

public Dictionary<string, OperationInfoTS>? Operations { get; set; }

348 378

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, PropertyName = "requiresEntityPack")]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4