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


One Answer:

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
73215

edited Mar 06 '15 at 04:54

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: 4,037 times

Last updated: Mar 06 '15 at 04:54

Related questions

powered by OSQA