Type filtering

 

The DB class has a new property TypeRules with a method

public TypeDefinitions IgnoreType(Type type)

which performs so called type filtering.

 

The type filtering feature allows ignoring some specific types (and their descendants) from being added into the database. All objects or fields or properties of ignored types will not appear in the database.

 

Fields and properties of ignored types will have their default values (usually null) when returned by a query.

 

The following types are automatically added into the ignored types list:

 

System.Runtime.ConstrainedExecution.CriticalFinalizerObject

System.Type

System.Reflection.Assembly

System.AppDomain

System.ActivationContext

System.Exception

System.AppDomainManager

System.IAppDomainSetup

System.ApplicationId

System.ApplicationIdentity

System.Attribute

System.Threading.WaitHandle

System.Runtime.InteropServices._AssemblyName

System.Reflection.Binder

System.IntPtr

System.Signature

System.WeakReference

System.Threading.Timer

System.Threading.TimerBase

System.Threading.SynchronizationContext

System.Threading.Overlapped

System.IntPtr

System.Windows.Threading.Dispatcher

System.Windows.DependencyProperty

System.Threading.CompressedStack

System.Threading.Monitor

System.IO.Stream

System.Runtime.Serialization.SerializationInfo

MS.Utility.FrugalListBase<>

MS.Utility.FrugalObjectList<>

System.Windows.Media.UniqueEventHelper<>

System.Windows.Media.UniqueEventHelper

System.Windows.Media.ColorContext

 

Usage example:

 

DB db = new DB(connectionString);

 

db.CreateDatabase("Sample");

db.OpenDatabase("Sample");

 

db.RegisterType(typeof(Book));

db.TypeRules.IgnoreType(typeof(DebugBook)); // This type will be ignored. Use this line only in database creation scripts.

 

db.Close();