Ejemplo n.º 1
0
        public int ToInsertStep([FromBody] AConFlowStep id)
        {
            var model = id;

            EnsureData(model);
            var allpos = m_codeService.InsertCode <AConFlowStep>(model);

            return(allpos);
        }
Ejemplo n.º 2
0
        public IActionResult SaveKeyvalue(int?id, string key, string value)
        {
            var recode = new  SystemDictionary();

            if (id == null)
            {
                recode = new SystemDictionary()
                {
                    AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String
                };
                APPCommon.AppConfig.SystemDictionaries.Add(recode);
                var result = m_codeService.InsertCode <SystemDictionary>(recode);
            }
            else
            {
                //var sd = new SystemDictionary();// { AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String };
                recode = m_codeService.GetSimpleCode <SystemDictionary>(new { Id = id }).FirstOrDefault();
                if (recode == null)
                {
                    recode = new  SystemDictionary()
                    {
                        AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String
                    };
                    APPCommon.AppConfig.SystemDictionaries.Add(recode);
                    var result = m_codeService.InsertCode <SystemDictionary>(recode);
                }
                else
                {
                    recode.KeyName = key;
                    recode.Value   = value;
                    m_codeService.UpdateSimpleCode(recode);
                    var sindex = APPCommon.AppConfig.SystemDictionaries.FindIndex(p => p.Id == recode.Id);
                    APPCommon.AppConfig.SystemDictionaries[sindex].KeyName = key;
                    APPCommon.AppConfig.SystemDictionaries[sindex].Value   = value;
                }
            }


            return(new JsonResult(new { result = recode }));
        }
Ejemplo n.º 3
0
        private ComposeEntity FindComposity(AppConfig appconfig, string allname)
        {
            lock (lockobj)
            {
                ComposeEntity cons = null;
                if (APPCommon.AppConfig.IsUseGloableCahe)
                {
                    cons = APP.Composeentitys.FirstOrDefault(p => p.Guid == appconfig.StartUpCompoistyID);
                    if (cons == null)
                    {
                        cons = CodeService.GetConposity(appconfig.StartUpCompoistyID, allname).FirstOrDefault();
                        if (cons != null)
                        {
                            APP.Composeentitys.Add(cons);
                        }
                    }
                }
                else
                {
                    cons = CodeService.GetConposity(appconfig.StartUpCompoistyID, allname).FirstOrDefault();
                }

                if (cons == null)
                {
                    cons = new ComposeEntity()
                    {
                        Name    = allname,
                        RunMode = RunMode.Coding,
                        Guid    = appconfig.StartUpCompoistyID
                    };
                    var reint = CodeService.InsertCode(cons);
                    APP.Composeentitys.Add(cons);
                }

                return(cons);
            }
        }
Ejemplo n.º 4
0
        private static async Task CheckAndRunNextRuntimeComposity(int requsetHash, HttpContext httpContext, RuntimeStepModel newrunmodel, ISqlSugarClient dbFactory, ISysDatabaseService codeService, IConfiguration config)
        {
            var resouce = newrunmodel.Resuce(newrunmodel.NextRunTimeKey);

            if (resouce != null)
            {
                var guid = (string)resouce;
                if (string.IsNullOrEmpty(guid))
                {
                    //newrunmodel.ResouceInfos.Remove(newrunmodel.NextRunTimeKey);
                    return;
                }
                var nextcon = codeService.GetConposity(guid).FirstOrDefault();
                if (nextcon == null)
                {
                    nextcon = new ComposeEntity()
                    {
                        Guid    = guid,
                        RunMode = RunMode.Coding
                    };
                    var reint = codeService.InsertCode(nextcon);
                }
                else
                {
                    var nextRnmodel = new RuntimeStepModel(config)
                    {
                        ParentRuntimeModel = newrunmodel,
                        Res           = newrunmodel.Res,
                        ComposeEntity = nextcon,
                        HashCode      = nextcon.GetHash()
                    };
                    nextRnmodel.Res.Remove(newrunmodel.NextRunTimeKey);
                    await RunComposity(requsetHash, httpContext, nextRnmodel, dbFactory, codeService, config);
                }
            }
        }
Ejemplo n.º 5
0
        public void ResgiterAllDll(string[] filepaths)
        {
            foreach (var f in filepaths)
            {
                Assembly asm      = Assembly.LoadFrom(f);
                var      fullname = asm.FullName;
                var      verunmer = asm.GetName().Version.ToString();

                var oldasscon = Dbclient.GetSimpleCode <AssemblyACon>(new { Name = asm.FullName }).FirstOrDefault();
                if (oldasscon == null)
                {
                    oldasscon         = new AssemblyACon();
                    oldasscon.AddTime = DateTime.Now;
                    AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
                    AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
                    AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));
                    string s = string.Format("Description:{0} Copyright:{1} Company:{2} ", asmdis != null ? asmdis.Description : string.Empty, asmcpr != null ? asmcpr.Copyright : string.Empty, asmcpn != null ? asmcpn.Company : string.Empty);
                    oldasscon.Description = s;
                    oldasscon.DllPath     = f;
                    oldasscon.IsVirtual   = false;
                    oldasscon.Name        = asm.FullName;
                    oldasscon.NameSpace   = asm.FullName;
                    oldasscon.VersionNum  = verunmer;
                    Dbclient.InsertCode(oldasscon);
                }
                else
                {
                    oldasscon.AddTime = DateTime.Now;
                    AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
                    AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
                    AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));
                    string s = string.Format("Description:{0} Copyright:{1} Company:{2} ", asmdis != null ? asmdis.Description : string.Empty, asmcpr != null ? asmcpr.Copyright : string.Empty, asmcpn != null ? asmcpn.Company : string.Empty);
                    oldasscon.Description = s;
                    oldasscon.DllPath     = f;
                    oldasscon.IsVirtual   = false;
                    oldasscon.NameSpace   = asm.FullName;
                    oldasscon.VersionNum  = verunmer;
                    Dbclient.UpdateSimpleCode(oldasscon);
                }
                var alltypes = asm.GetTypes().Where(p => p.IsAbstract == false &&
                                                    p.IsPublic == true
                                                    //&& p.Name != "ToString" && p.Name != "GetType"
                                                    && !p.Name.StartsWith("AspNetCore"));
                foreach (var t in alltypes)
                {
                    var oldtype = Dbclient.GetSimpleCode <TypeDefinition>(new { FullName = t.FullName }).FirstOrDefault();
                    if (oldtype == null)
                    {
                        oldtype                    = new TypeDefinition();
                        oldtype.AddTime            = DateTime.Now;
                        oldtype.ClassName          = t.Name;
                        oldtype.FullName           = t.FullName;
                        oldtype.GUID               = t.GUID;
                        oldtype.IsAbstract         = t.IsAbstract;
                        oldtype.IsArray            = t.IsArray;
                        oldtype.IsAutoLayout       = t.IsAutoLayout;
                        oldtype.IsClass            = t.IsClass;
                        oldtype.IsEnum             = t.IsEnum;
                        oldtype.IsGenericType      = t.IsGenericType;
                        oldtype.IsInterface        = t.IsInterface;
                        oldtype.IsNestedFamORAssem = t.IsNestedFamORAssem;
                        oldtype.IsNotPublic        = t.IsNotPublic;
                        oldtype.IsPublic           = t.IsPublic;
                        oldtype.IsSealed           = t.IsSealed;
                        oldtype.IsSpecialName      = t.IsSpecialName;
                        oldtype.IsValueType        = t.IsValueType;
                        oldtype.IsVisible          = t.IsVisible;
                        oldtype.Namespace          = t.Namespace;
                        oldtype.VersionNum         = verunmer;
                        oldtype.AliName            = t.FullName;
                        var reInt = Dbclient.InsertCode(oldtype);

                        oldtype.Id = reInt;
                    }
                    else
                    {
                        oldtype.AddTime            = DateTime.Now;
                        oldtype.VersionNum         = verunmer;
                        oldtype.ClassName          = t.Name;
                        oldtype.GUID               = t.GUID;
                        oldtype.IsAbstract         = t.IsAbstract;
                        oldtype.IsArray            = t.IsArray;
                        oldtype.IsAutoLayout       = t.IsAutoLayout;
                        oldtype.IsClass            = t.IsClass;
                        oldtype.IsEnum             = t.IsEnum;
                        oldtype.IsGenericType      = t.IsGenericType;
                        oldtype.IsInterface        = t.IsInterface;
                        oldtype.IsNestedFamORAssem = t.IsNestedFamORAssem;
                        oldtype.IsNotPublic        = t.IsNotPublic;
                        oldtype.IsPublic           = t.IsPublic;
                        oldtype.IsSealed           = t.IsSealed;
                        oldtype.IsSpecialName      = t.IsSpecialName;
                        oldtype.IsValueType        = t.IsValueType;
                        oldtype.IsVisible          = t.IsVisible;
                        oldtype.Namespace          = t.Namespace;
                        oldtype.AliName            = t.FullName;
                        Dbclient.UpdateSimpleCode(oldasscon);
                    }

                    var methodinfos = t.GetMethods().Where(p => p.IsAbstract == false && p.IsVirtual == false &&
                                                           p.MemberType == MemberTypes.Method && p.IsPublic == true &&
                                                           p.Name != "ToString" && p.Name != "GetType" &&
                                                           !p.Name.StartsWith("get") &&
                                                           !p.Name.StartsWith("set"));
                    foreach (var m in methodinfos)
                    {
                        string parameterInfo, retuentype, mfullname;
                        NewMethod(t, m, out parameterInfo, out retuentype, out mfullname);
                        var oldmethod = Dbclient.GetSimpleCode <MethodDefinition>(new { FullName = mfullname }).FirstOrDefault();
                        if (oldmethod == null)
                        {
                            oldmethod               = new MethodDefinition();
                            oldmethod.AddTime       = DateTime.Now;
                            oldmethod.BelongTypeId  = oldtype.Id;
                            oldmethod.FullName      = mfullname;
                            oldmethod.IsPrivate     = m.IsPrivate;
                            oldmethod.IsPublic      = m.IsPublic;
                            oldmethod.IsStatic      = m.IsStatic;
                            oldmethod.MemberType    = m.MemberType;
                            oldmethod.Name          = m.Name;
                            oldmethod.ParameterInfo = parameterInfo;
                            oldmethod.ReturnType    = retuentype;
                            oldmethod.VersionNum    = verunmer;
                            Dbclient.InsertCode(oldmethod);
                        }
                        else
                        {
                            oldmethod.AddTime       = DateTime.Now;
                            oldmethod.BelongTypeId  = oldtype.Id;
                            oldmethod.FullName      = mfullname;
                            oldmethod.IsPrivate     = m.IsPrivate;
                            oldmethod.IsPublic      = m.IsPublic;
                            oldmethod.IsStatic      = m.IsStatic;
                            oldmethod.MemberType    = m.MemberType;
                            oldmethod.Name          = m.Name;
                            oldmethod.ParameterInfo = parameterInfo;
                            oldmethod.ReturnType    = retuentype;
                            oldmethod.VersionNum    = verunmer;
                            Dbclient.UpdateSimpleCode(oldmethod);
                        }
                    }
                }
            }
        }