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:
- if you do not specify database then DO will apply this rule to default database;
- if you do not specify schema then DO will apply this rule to default schema;
- 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 Kulakov
772●2●5