Exemplo n.º 1
0
 /// <summary>
 /// 增加架构配置表,存在则更新
 /// </summary>
 /// <param name="type"></param>
 /// <param name="schema"></param>
 public static void AddSchema(Type type, SchemaTable schema)
 {
     if (type != null && !string.IsNullOrEmpty(type.FullName))
     {
         SchemaTable oldValue;
         if (SchemaSet.TryGetValue(type.FullName, out oldValue))
         {
             SchemaSet.TryUpdate(type.FullName, schema, oldValue);
         }
         else
         {
             SchemaSet.TryAdd(type.FullName, schema);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="scriptCode"></param>
        /// <param name="typeName"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public override object Execute(string scriptCode, string typeName, params object[] args)
        {
            string code = FormatScriptCode(SettupInfo.CSharpScriptPath, scriptCode, ".cs");

            if (_csharpCodeCache.TryGetValue(code, out var ad))
            {
                object result;
                if (args.Length == 0)
                {
                    if ((result = Execute(ad.Source, true)) != null)
                    {
                        return(result);
                    }
                }
                if ((result = Execute(ad.Source, true, args)) != null)
                {
                    return(result);
                }
            }
            else
            if (typeName != null)
            {
            }
            return(base.Execute(scriptCode, typeName, args));
        }
Exemplo n.º 3
0
        private static bool TryLoadProxy <T>(string comKey, out T proxy) where T : ComProxy
        {
            proxy = null;
            ComProxy comProxy;

            if (_pools.TryGetValue(comKey, out comProxy))
            {
                proxy = (T)comProxy;
                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
        private static void OnCheckLogTable(string key, object value, CacheRemovedReason reason)
        {
            try
            {
                var tableTypes = _logTables.ToList();
                foreach (var type in tableTypes)
                {
                    SchemaTable schema;
                    if (!SchemaSet.TryGetValue(type, out schema))
                    {
                        continue;
                    }
                    DbBaseProvider dbprovider = DbConnectionProvider.CreateDbProvider(schema);
                    if (dbprovider == null)
                    {
                        continue;
                    }
                    string tableName = "";
                    string format    = "";
                    for (int i = 0; i < LogPriorBuildMonth; i++)
                    {
                        int month = i;
                        format    = LogTableNameFormat.Replace("$date", DateTime.Now.AddMonths(month).ToString("yyyyMM"));
                        tableName = string.Format(format, schema.SpecialName);

                        DbColumn[] columns;
                        if (!dbprovider.CheckTable(tableName, out columns))
                        {
                            CreateTableSchema(schema, dbprovider, tableName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("OnCheckLogTable error:{0}", ex);
            }
        }