Esempio n. 1
0
 internal static Exception SqlChangeTrackingNotEnabled(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SqlChangeTrackingNotEnabled", new object[1]
     {
         (object)tableName
     })));
 }
Esempio n. 2
0
        internal static void CheckForAdapterRowIds(DbSyncAdapterCollection adapters)
        {
            List <string> list = new List <string>();

            foreach (DbSyncAdapter dbSyncAdapter in (Collection <DbSyncAdapter>)adapters)
            {
                if (dbSyncAdapter.RowIdColumns.Count == 0)
                {
                    list.Add(dbSyncAdapter.TableName);
                }
            }
            if (list.Count <= 0)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            string        str1          = string.Empty;

            foreach (string str2 in list)
            {
                stringBuilder.Append(str1 + str2);
                str1 = ", ";
            }
            SyncTracer.Error(SyncResource.FormatString("MissingAdapterRowIdColumns", new object[0]), new object[1]
            {
                (object)((object)stringBuilder).ToString()
            });
            throw new DbSyncException(SyncResource.FormatString("MissingAdapterRowIdColumns", new object[1]
            {
                (object)((object)stringBuilder).ToString()
            }));
        }
Esempio n. 3
0
 internal static Exception DuplicateSyncAdapter(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SyncAdapterAlreadyExists", new object[1]
     {
         (object)tableName
     })));
 }
Esempio n. 4
0
 internal static ArgumentException MaxNumberOfCustomParameters(int maxCustomParameters)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("MaxNumberOfCustomParameters", new object[1]
     {
         (object)maxCustomParameters.ToString((IFormatProvider)CultureInfo.InvariantCulture)
     })));
 }
Esempio n. 5
0
 internal static Exception DuplicateSyncParameterName(string parameterName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("DuplicateParamName", new object[1]
     {
         (object)parameterName
     })));
 }
Esempio n. 6
0
 internal static Exception SyncTableBelongsToDifferentCollection(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SyncTableParentExists", new object[1]
     {
         (object)tableName
     })));
 }
Esempio n. 7
0
 internal static ArgumentException MaxSyncAnchorSize(int maxAnchorSize)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("MaxSyncAnchorSize", new object[1]
     {
         (object)maxAnchorSize.ToString((IFormatProvider)CultureInfo.InvariantCulture)
     })));
 }
Esempio n. 8
0
        internal static SchemaException ReadingSchemaFromDataSetError(Collection <string> tableNames, string source, string helpLink, SyncErrorNumber code, Exception inner)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (string str in tableNames)
            {
                stringBuilder.Append(str).Append(", ");
            }
            string str1 = "";

            if (stringBuilder.Length > 2 && ((object)stringBuilder).ToString().EndsWith(", ", StringComparison.Ordinal))
            {
                str1 = ((object)stringBuilder).ToString().Substring(0, stringBuilder.Length - 2);
            }
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ServerSyncProvider_GetSchemaFromDatabase_Failed", new object[1]
            {
                (object)str1
            }), inner);

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.ReadingSchema;
            schemaException.ErrorNumber = code;
            schemaException.TableName   = str1;
            schemaException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 9
0
 internal static Exception InvalidSyncTableName(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("InvalidTableName", new object[1]
     {
         (object)tableName
     })));
 }
Esempio n. 10
0
 internal static ArgumentException ParameterNotSet(string parameter)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("ParameterNotSet", new object[1]
     {
         (object)parameter
     })));
 }
Esempio n. 11
0
        internal static bool OpenConnection(IDbConnection connection)
        {
            SyncExpt.CheckArgumentNull((object)connection, "connection");
            bool flag = false;

            switch (connection.State)
            {
            case ConnectionState.Closed:
                if (SyncTracer.IsVerboseEnabled())
                {
                    if (connection is SqlConnection)
                    {
                        SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder();
                        connectionStringBuilder.ConnectionString = connection.ConnectionString;
                        if (!string.IsNullOrEmpty(connectionStringBuilder.Password))
                        {
                            connectionStringBuilder.Password = "******";
                        }
                        SyncTracer.Verbose("Connecting using string: {0}", new object[1]
                        {
                            (object)connectionStringBuilder.ConnectionString
                        });
                    }
                    else
                    {
                        SyncTracer.Verbose("Connecting to database: {0}", new object[1]
                        {
                            (object)connection.Database
                        });
                    }
                }
                if (connection is SqlConnection || connection is IConnectionWrapper)
                {
                    SyncUtil.TryOpenConnection(connection);
                }
                else
                {
                    connection.Open();
                }
                flag = true;
                goto case ConnectionState.Open;

            case ConnectionState.Open:
                return(flag);

            case ConnectionState.Broken:
                SyncTracer.Verbose("Closing broken connection");
                connection.Close();
                goto case ConnectionState.Closed;

            default:
                throw new DbSyncException(SyncResource.FormatString("UnhandledConnectionState", new object[1]
                {
                    (object)((object)connection.State).ToString()
                }));
            }
        }
Esempio n. 12
0
        internal static ArgumentException SyncMetadataColumnNotExists(string tableName, string columnName, string columnType)
        {
            ArgumentException argumentException = new ArgumentException(SyncResource.FormatString("SyncMetadataColumnNotExists", (object)columnType, (object)columnName, (object)tableName));

            SyncTracer.Warning("{0}", new object[1]
            {
                (object)argumentException
            });
            return(argumentException);
        }
Esempio n. 13
0
        internal static ArgumentException InvalidProviderDataType(string providerType, string columnName, string tableName)
        {
            ArgumentException argumentException = new ArgumentException(SyncResource.FormatString("InvalidProviderDataType", (object)providerType, (object)columnName, (object)tableName));

            SyncTracer.Warning("{0}", new object[1]
            {
                (object)argumentException
            });
            return(argumentException);
        }
Esempio n. 14
0
        internal static ArgumentException ColumnNotExistsInTableError(string tableName, string columnName)
        {
            ArgumentException argumentException = new ArgumentException(SyncResource.FormatString("ColumnNotExistsInTable", (object)tableName, (object)columnName));

            SyncTracer.Warning("{0}", new object[1]
            {
                (object)argumentException
            });
            return(argumentException);
        }
Esempio n. 15
0
        internal static ArgumentException InvalidNumericColumnOperation(string tableName, string columnName)
        {
            ArgumentException argumentException = new ArgumentException(SyncResource.FormatString("SyncSchema_NotNumeric", (object)tableName, (object)columnName));

            SyncTracer.Warning("{0}", new object[1]
            {
                (object)argumentException
            });
            return(argumentException);
        }
Esempio n. 16
0
        internal static DataSyncException FailedToExecuteCommand(string command, string table, Exception expt, string source, string helpLink, SyncStage stage)
        {
            DataSyncException dataSyncException = new DataSyncException(SyncResource.FormatString("FailedToExecuteCommand", (object)command, (object)table), expt);

            dataSyncException.SyncSource = source;
            dataSyncException.HelpLink   = helpLink;
            dataSyncException.SyncStage  = stage;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)dataSyncException
            });
            return(dataSyncException);
        }
Esempio n. 17
0
        internal static DataSyncException MissingPrimaryKeyValue(string tableName, string primaryKeyName, SyncStage stage, string source, string helpLink)
        {
            DataSyncException dataSyncException = new DataSyncException(SyncResource.FormatString("MissingPrimaryKeyValue", (object)primaryKeyName, (object)tableName));

            dataSyncException.SyncSource  = source;
            dataSyncException.SyncStage   = stage;
            dataSyncException.ErrorNumber = SyncErrorNumber.PrimaryKeyNotFound;
            dataSyncException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)dataSyncException
            });
            return(dataSyncException);
        }
Esempio n. 18
0
        internal static DataSyncException EnumeratingDeletesError(string source, string helpLink, Exception inner, string tableName, string groupName)
        {
            DataSyncException dataSyncException = new DataSyncException(SyncResource.FormatString("ServerSyncProvider_GetChanges_Failed", (object)tableName, (object)groupName), inner);

            dataSyncException.SyncSource  = source;
            dataSyncException.SyncStage   = SyncStage.GettingDeletes;
            dataSyncException.ErrorNumber = SyncErrorNumber.StoreException;
            dataSyncException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)dataSyncException
            });
            return(dataSyncException);
        }
Esempio n. 19
0
        internal static SchemaException CreatingTableError(string tableName, string createScript, string source, string helpLink, Exception inner)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ErrorCreatingTable", (object)tableName, (object)createScript), inner);

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.CreatingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.StoreException;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 20
0
        internal static SchemaException InsufficientColumnInformationError(string tableName, string columnName, string property, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("InsufficientColumnInformation", (object)columnName, (object)tableName, (object)property));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.CreatingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.InvalidValue;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 21
0
        internal static MetadataException WritingTableAnchorError(string tableName, string anchorType, string source, string helpLink, SyncErrorNumber code)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_SetTableAnchorFailed", (object)anchorType, (object)tableName));

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.WritingMetadata;
            metadataException.ErrorNumber = code;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
Esempio n. 22
0
        internal static SchemaException InvalidOriginatorIdColumnType(string tableName, string columnName, string source)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("InvalidOriginatorIdColumn", new object[1]
            {
                (object)columnName
            }));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.ReadingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.InvalidValue;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 23
0
        internal static MetadataException SubscribingTableError(string tableName, string source, string helpLink)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_ErrorInSubscribingTable", new object[1]
            {
                (object)tableName
            }));

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.WritingMetadata;
            metadataException.ErrorNumber = SyncErrorNumber.AddingTableMetadataFailed;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
Esempio n. 24
0
        internal static SchemaException FillSchemaError(string tableName, string source, string helpLink, Exception inner)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ServerSyncProvider_GetSchemaFromDatabase_Failed", new object[1]
            {
                (object)tableName
            }), inner);

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.ReadingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.StoreException;
            schemaException.TableName   = tableName;
            schemaException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 25
0
        internal static SchemaException PrimaryKeyNotFoundError(string tableName, SyncStage stage, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("PrimaryKeyNotFound", new object[1]
            {
                (object)tableName
            }));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = stage;
            schemaException.ErrorNumber = SyncErrorNumber.PrimaryKeyNotFound;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 26
0
        internal static SchemaException TableDoesNotExistError(string tableName, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("TableDoesNotExist", new object[1]
            {
                (object)tableName
            }));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.CreatingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.TableDoesNotExist;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 27
0
        internal static SchemaException EstablishingRelationError(ForeignKeyConstraint fk, string commandText, string source, string helpLink, Exception inner)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ErrorEstablishingRelationEx", (object)fk.ConstraintName, (object)commandText), inner);

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.CreatingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.StoreException;
            schemaException.HelpLink    = helpLink;
            if (fk.RelatedTable != null)
            {
                schemaException.TableName = fk.RelatedTable.TableName;
            }
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 28
0
        internal static SchemaException SchemaNotMatchError(string tableName, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ServerSyncProvider_GetChanges_SchemaNotMatch", new object[1]
            {
                (object)tableName
            }));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.DownloadingChanges;
            schemaException.ErrorNumber = SyncErrorNumber.StoreException;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Esempio n. 29
0
        internal static MetadataException CreateSystemTablesError(string tableName, string source, string helpLink, Exception inner)
        {
            MetadataException metadataException = new MetadataException(SyncResource.FormatString("Internal_ErrorCreatingSystemTables", new object[1]
            {
                (object)tableName
            }), inner);

            metadataException.SyncSource  = source;
            metadataException.SyncStage   = SyncStage.CreatingMetadata;
            metadataException.ErrorNumber = SyncErrorNumber.StoreException;
            metadataException.HelpLink    = helpLink;
            metadataException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)metadataException
            });
            return(metadataException);
        }
Esempio n. 30
0
        internal static SchemaException ClientSchemaNotMatchError(string tableName, SyncStage stage, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.FormatString("ApplyChanges_ClientSchemaNotMatchError", new object[1]
            {
                (object)tableName
            }));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = stage;
            schemaException.ErrorNumber = SyncErrorNumber.StoreException;
            schemaException.HelpLink    = helpLink;
            schemaException.TableName   = tableName;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }