Hello, we want to use Microsoft SQL Replication and it will create special system tables in our database but when we do perform these system tables removed , what can i do to skip those tables from removing.

asked Mar 05 '15 at 08:07

mahmoudawadelsayed's gravatar image

mahmoudawadelsayed
5111


2 Answers:

Hello mahmoudawadelsayed.

DataObjects.Net allows you ignore some tables and columns since 5.0.0 Beta 1.

There is collection of ignore rules in DomainConfiguration. You can define rules in code or using config file.

There are some rules:

  1. if you do not specify database then DO will apply this rule to default database;
  2. if you do not specify schema then DO will apply this rule to default schema;
  3. if you do not specify table then DO will apply this rule to any table in specified (or default) schema and specified (or default) database.

Code samples:


//You can ignore table in default schema and default database
domainConfiguration.IgnoreRules.IgnoreTable("SomeTableName");

//Ignore rule for table in specified schema and default database domainConfiguration.IgnoreRules.IgnoreTable("AnotherTableName").WhenSchema("schemaName");

//Ignore rule for table in specified schema and database domainConfiguration.IgnoreRules.IgnoreTable("AnotherTableName").WhenSchema("schemaName").WhenDatabase("databaseName");

//Ignore rule for column in any table for default schema and default database domainConfiguration.IgnoreRules.IgnoreColumn("hiddenColumn");

//Ignore rule for column in specified table of default schema and default database domainConfiguration.IgnoreRules.IgnoreColumn("HiddenColumn").WhenTable("TableWithHiddenColumn");

//Ignore table and column by mask. //All columns which name starts with "Hidden" //will be ignored in every table which ends //with "WithHiddenColumn" domainConfiguration.IgnoreRules.IgnoreColumn("Hidden").WhenTable("WithHiddenColumn");

Configuration file samples


<domain name="IgnoreRuleConfigTest" connectionurl="sqlserver://localhost/" defaultdatabase="main" defaultschema="dbo" allowcyclicdatabasedependencies="true">
  <mappingrules>
    <rule namespace="Model.FirstDatabaseModel" schema="myschema"/>
    <rule assembly="Model.SecondDatabaseModel" database="other"/>
  </mappingrules>
  <ignorerules>
    <rule database="Other-DO40-Tests" schema="dbo" table="IgnoredTable"/>
    <rule database="other" schema="dbo" column="HiddenColumn"/>
    <rule database="main" schema="myschema" table="AnotherIgnoredTable" column="HiddenColumn"/>
    <rule table="HiddenTable"/>
    <rule column="Hidden*"/>
  </ignorerules>
  <databases>
    <database name="main" realname="DO40-Tests"/>
    <database name="other" realname="Other-DO40-Tests"/>
  </databases>
</domain>

Notice, you can use real name or mapped name in ignore rules.

answered Mar 06 '15 at 04:51

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

edited Mar 06 '15 at 04:54

The correct syntax is: ignoreRules NOT ignorerules

answered Jul 29 '20 at 13:57

Nomad99's gravatar image

Nomad99
7447

edited Jul 29 '20 at 13:58

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×1

Asked: Mar 05 '15 at 08:07

Seen: 6,268 times

Last updated: Jul 29 '20 at 13:58

Related questions

powered by OSQA