コード例 #1
0
 public static bool AddErrorMessage(SqlException exception, Action <string> addErrorMessage, long id, string originalTableName)
 {
     using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
     {
         var resolver = new ReferencesConflictResolver(db);
         return(resolver.Resolve(exception, addErrorMessage, id, originalTableName));
     }
 }
コード例 #2
0
        public static string GetTableHeader(string projectCode, string tableName, string version, string publicKeyToken)
        {
            var cacheKey = tableName + ":" + LocalizationHelper.IsCultureKZ;

            if (ProjectHeadersCache.ContainsKey(cacheKey))
            {
                return(ProjectHeadersCache[cacheKey]);
            }

            string header = null;
            var    type   = BuildManager.GetType(
                string.Format(
                    "{1}.Properties.{0}Resources, {1}, Version={2}, Culture=neutral, PublicKeyToken={3}",
                    tableName,
                    projectCode,
                    version ?? InitializerSection.GetSection().DefaultVersion,
                    publicKeyToken ?? InitializerSection.GetSection().DefaultPublicKeyToken),
                false,
                true);

            var property = type?.GetProperty("Header", BindingFlags.Static | BindingFlags.Public);

            if (property != null)
            {
                header = (string)property.GetValue(null, new object[0]);
            }

            if (string.IsNullOrEmpty(header))
            {
                using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
                {
                    header = CacheQueries.GetNameCached <MON_RequestTable, string, string>(
                        db,
                        tableName,
                        (r, value) => r.TableCode == value,
                        r => r.TableName);
                }
            }

            if (string.IsNullOrEmpty(header))
            {
                header = tableName;
            }

            return(ProjectHeadersCache[cacheKey] = header);
        }
コード例 #3
0
        public static string GetProjectCode(string tableName)
        {
            if (ProjectCodesCache.ContainsKey(tableName))
            {
                return(ProjectCodesCache[tableName]);
            }

            string projectCode;

            using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
            {
                projectCode = CacheQueries.ExecuteFunction <MON_RequestTable, string, string>(
                    db,
                    tableName,
                    (r, value) => r.TableCode == value,
                    r => r.PackageCode);
            }

            return(ProjectCodesCache[tableName] = projectCode);
        }
コード例 #4
0
 private ReferencesConflictResolver(DBDataContext db)
 {
     this.db = db;
 }