public void Test() { FDC <string, string> fdc = new FDC <string, string>(); fdc = fdc | model.Model1 | BuilderModel <string, string> .Creator | OperatorModel <string, string> .Creator; Assert.Equal(@"fixed (char* c = arg){ switch (*(ushort*)(c+0)){case 48: 0 break; case 49: 1 break; case 50: 2 break; case 51: 3 break; case 52: 4 break; case 53: 5 break; case 54: 6 break; case 55: 7 break; case 56: 8 break; case 57: 9 break; }}UTProject.Model.OperatorModel<System.String,System.String>.Creator = UTProject.Model.BuilderModel<System.String,System.String>.Creator(arg); return UTProject.Model.OperatorModel<System.String,System.String>.Creator(arg); ", fdc.ToString()); }
public static Func <string, LinkBase> Ctor(Type type) { StrTypeCache[type.GetDevelopName()] = type; //获得动态生成的类型 Type result = LinkBuilder.InitType(type, Core.Model.FindTreeType.Fuzzy); //加入缓存 string script = $"return new {result.GetDevelopName()}();"; _str_cache[type.GetDevelopName()] = script; _type_cache[type] = script; //生成脚本 FDC <Type, LinkBase> handler = default; if (_fdc.BuilderInfo != null) { handler = _fdc | _str_cache; } else { handler = (_fdc | _str_cache | FuzzyLinkOperator.CreateFromString | FuzzyLinkBuilder.Ctor) % CallerManagement.GetTypeFunc; } return(NDelegate.UseDomain(type.GetDomain()).UnsafeFunc <string, LinkBase>(handler.ToString(), _type_cache.Keys.ToArray(), "NCallerDynamic", "NCaller.Builder")); }