An *Analyzer object* is practically any instance of a class that inherits from `AnalyticalObject` In actuality, in the constructor of the class doing the inheritance is where the actual definition happens. ## Example ### Example model to de-normalize. ```csharp class AnotherClass { public string Id {get; set;} } class SomeClass { public int Number {get; set;} public string Id {get; set;} public AnotherClass NestedClass {get; set;} } ``` To de-normalize this, we define an *Analyzer* as follows: ```csharp // This gives a denormalized TypeMap with defaults for each property. class SomeClassAnalyzer : AnalyticalObject {} ``` To add type casting and the like, we need to use the [Fluent Syntax](https://en.wikipedia.org/wiki/Fluent_interface) ```csharp class SomeClassAnalyzer : AnalyticalObject { public SomeClassAnalyzer(){ //This will cast Number correlate the number //to type string for use in other modules, like loading into a database Property(s => s.Number).HasInternalType(InternalType.STRING) } } ``` It is possible in this constructor, to bring reference to classes that are not within the scope of the current model. For example: ```csharp class OutsideClass { public string Name {get; set;} public int Number {get; set;} } class SomeClass { public int Number {get; set;} public string Id {get; set;} public AnotherClass NestedClass {get; set;} //We have the id for a class that will need to be retrieved. public int OutsideClassId {get; set;} } ``` To solve this problem, we can define that this need will be used to retrieve further data like so: ```csharp class SomeClassAnalyzer : AnalyticalObject { public SomeClassAnalyzer(){ //This will cast Number correlate the number //to type string for use in other modules, like loading into a database Property(s => s.Number).HasInternalType(InternalType.STRING) // We define the name of the service, and pass an analyzer. // Note, this creates a default analyzer and a custom analyzer may be passed. Property(s => s.OutsideClassId) .GetFromService("OutsideClassService", AnalyticalObject()) } } ``` For handling of pre-initialization business of the definition, a builder object can be passed to the base constructor. ```csharp class SomeClassAnalyzer : AnalyticalObject { public SomeClassAnalyzer() : base(a => { // To handle reference loops (self-referencing classes) a.ReferenceLoopDepthLimit = 2; // To ignore. a.Ignore(s => s.Number); }) { Property(s => s.OutsideClassId) .GetFromService("OutsideClassService", AnalyticalObject()) } } ``` Although less efficient, it is possible to remove properties after they have already been initialized. ```csharp class SomeClassAnalyzer : AnalyticalObject { public SomeClassAnalyzer(){ //This will cast Number correlate the number //to type string for use in other modules, like loading into a database Property(s => s.Number).HasInternalType(InternalType.STRING) Remove(s => s.Number); } } ``` This could be used if you need to alter the schema at runtime. ```csharp SomeClassAnalyzer analyzer = new SomeClassAnalyzer(); analyzer.Remove(s => s.Number); ```