Beispiel #1
0
        static async Task Main(string[] args)
        {
            var tables = new AuditTableCollection()
            {
                {
                    "dbo", new string[]
                    {
                        "products"
                    }
                },
            };
            IReplicator replicator = new Setup(@"Data Source=10.10.100.68\SQL2016;Initial Catalog=learns;User ID=spsauser;Password=$P$@789#")
                                     .UseCDC()
                                     .DoNotTrackSchemaChanges()
                                     .Directory(@"C:\Users\Public")
                                     .AllowDataLoss()
                                     .Tables(tables)
                                     .GetReplicator();

            try
            {
                await replicator.StartAsync();

                Console.WriteLine("Completed run");
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            Console.ReadKey();
        }
Beispiel #2
0
        public static AuditTableCollection ToAuditCollection(this IEnumerable <KeyValuePair <string, string[]> > keyValuePairs)
        {
            if (keyValuePairs == null)
            {
                return(null);
            }

            AuditTableCollection result = new AuditTableCollection();

            foreach (var key in keyValuePairs)
            {
                result.Add(key.ToString(), key.Value);
            }
            return(result);
        }
        public static HashSet <string> ToHashSet(AuditTableCollection tables)
        {
            if (tables == null)
            {
                return(null);
            }

            HashSet <string> result = new HashSet <string>();

            foreach (var schema in tables)
            {
                foreach (var table in schema.Value)
                {
                    result.Add(schema.Key + "." + table);
                }
            }
            return(result);
        }
Beispiel #4
0
        static async Task Main(string[] args)
        {
            var tables = new AuditTableCollection()
            {
                {
                    "dbo", new string[]
                    {
                        "groups",
                        "products"
                    }
                },
                //{
                //    "sales",new string[]
                //    {
                //        "orders",
                //        "details"
                //    }
                //},
            };

            IReplicator replicator = new Setup(@"Data Source=10.10.100.68\SQL2016;Initial Catalog=learns;User ID=spsauser;Password=$P$@789#")
                                     .Directory(@"C:\Users\Public")
                                     .Tables(tables)
                                     .GetReplicator();

            try
            {
                await replicator.StartAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
            Console.WriteLine("Ran completely");
            Console.ReadKey();
        }