2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-12-17 01:10:25 +00:00
This commit is contained in:
2022-02-12 15:37:45 +03:00
parent 25260c6155
commit d41911b1ab
9 changed files with 280 additions and 77 deletions

View File

@@ -482,12 +482,12 @@ class Warehouse {
return rt;
}
static T createInstance<T>(Type T) {
return _factory[T]?.instanceCreator.call();
static T createInstance<T>(Type type) {
return _factory[type]?.instanceCreator.call();
}
static List<T> createArray<T>(Type T) {
return _factory[T]?.arrayCreator.call();
static List<T> createArray<T>(Type type) {
return _factory[type]?.arrayCreator.call();
}
static AsyncReply<T> newResource<T extends IResource>(String name,
@@ -546,16 +546,17 @@ class Warehouse {
/// </summary>
/// <param name="type">.Net type.</param>
/// <returns>Resource template.</returns>
static TypeTemplate getTemplateByType(Type type) {
static TypeTemplate? getTemplateByType(Type type) {
// loaded ?
for (var tmps in _templates.values)
for (var tmp in tmps.values) if (tmp.definedType == type) return tmp;
//if (tmp.className == type.toString()) return tmp;
//try {
var template = new TypeTemplate.fromType(type, true);
return template;
//} catch (ex) {
// return null;
//}
}
/// <summary>