Example #1
0
 internal static Exception SqlChangeTrackingNotEnabled(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SqlChangeTrackingNotEnabled", new object[1]
     {
         (object)tableName
     })));
 }
Example #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()
            }));
        }
Example #3
0
 internal static Exception DuplicateSyncAdapter(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SyncAdapterAlreadyExists", new object[1]
     {
         (object)tableName
     })));
 }
Example #4
0
 internal static Exception InvalidSyncTableName(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("InvalidTableName", new object[1]
     {
         (object)tableName
     })));
 }
Example #5
0
 internal static Exception DuplicateSyncParameterName(string parameterName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("DuplicateParamName", new object[1]
     {
         (object)parameterName
     })));
 }
Example #6
0
 internal static Exception SyncTableBelongsToDifferentCollection(string tableName)
 {
     return((Exception)SyncExpt.Argument(SyncResource.FormatString("SyncTableParentExists", new object[1]
     {
         (object)tableName
     })));
 }
Example #7
0
 internal static ArgumentException MaxNumberOfCustomParameters(int maxCustomParameters)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("MaxNumberOfCustomParameters", new object[1]
     {
         (object)maxCustomParameters.ToString((IFormatProvider)CultureInfo.InvariantCulture)
     })));
 }
Example #8
0
 internal static ArgumentException MaxSyncAnchorSize(int maxAnchorSize)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("MaxSyncAnchorSize", new object[1]
     {
         (object)maxAnchorSize.ToString((IFormatProvider)CultureInfo.InvariantCulture)
     })));
 }
Example #9
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);
        }
Example #10
0
 internal static ArgumentException ParameterNotSet(string parameter)
 {
     return(SyncExpt.Argument(SyncResource.FormatString("ParameterNotSet", new object[1]
     {
         (object)parameter
     })));
 }
Example #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()
                }));
            }
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
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);
        }
Example #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);
        }
Example #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);
        }
Example #17
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);
        }
Example #18
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);
        }
Example #19
0
        internal static DataSyncException AnotherSyncInProgressError(string source, string helpLink)
        {
            DataSyncException dataSyncException = new DataSyncException(SyncResource.GetString("SyncAlreadyStarted"), (Exception)null);

            dataSyncException.SyncSource  = source;
            dataSyncException.HelpLink    = helpLink;
            dataSyncException.SyncStage   = SyncStage.ReadingMetadata;
            dataSyncException.ErrorNumber = SyncErrorNumber.SyncInProgress;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)dataSyncException
            });
            return(dataSyncException);
        }
Example #20
0
        internal static DataSyncException EnumeratingChangesError(string source, string helpLink, Exception inner, SyncStage stage)
        {
            DataSyncException dataSyncException = new DataSyncException(SyncResource.GetString("ClientSyncProvider_GetChanges_Failed"), inner);

            dataSyncException.SyncSource  = source;
            dataSyncException.SyncStage   = stage;
            dataSyncException.ErrorNumber = SyncErrorNumber.StoreException;
            dataSyncException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)dataSyncException
            });
            return(dataSyncException);
        }
Example #21
0
        internal static SchemaException MissingSelectStatementError(string tableName, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.GetString("SyncAdapter_FillSchema_SelectCommandMissing"));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.ReadingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.MissingSelectCommand;
            schemaException.TableName   = tableName;
            schemaException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Example #22
0
        internal static SchemaException InvalidSchemaDataSetError(string tableName, string source, string helpLink)
        {
            SchemaException schemaException = new SchemaException(SyncResource.GetString("ServerSyncProvider_Invalid_Schema_dataset"));

            schemaException.SyncSource  = source;
            schemaException.SyncStage   = SyncStage.ReadingSchema;
            schemaException.ErrorNumber = SyncErrorNumber.InvalidSchemaDataSet;
            schemaException.TableName   = tableName;
            schemaException.HelpLink    = helpLink;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)schemaException
            });
            return(schemaException);
        }
Example #23
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);
        }
Example #24
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);
        }
Example #25
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);
        }
Example #26
0
        internal static AnchorException ReadingAnchorError(SyncGroupMetadata metadata, SyncSession session, string source, string helpLink, Exception inner)
        {
            AnchorException anchorException = new AnchorException(SyncResource.GetString("GetNewServerAnchorFailed"), inner);

            anchorException.SyncSource    = source;
            anchorException.SyncStage     = SyncStage.DownloadingChanges;
            anchorException.ErrorNumber   = SyncErrorNumber.StoreException;
            anchorException.GroupMetadata = metadata;
            anchorException.HelpLink      = helpLink;
            anchorException.Session       = session;
            SyncTracer.Warning("{0}", new object[1]
            {
                (object)anchorException
            });
            return(anchorException);
        }
Example #27
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);
        }
Example #28
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);
        }
Example #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);
        }
Example #30
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);
        }