Data Access has been discontinued. Please refer to this page for more information.

How to: Debug Your Fluent Mapping Project

Telerik Data Access uses Enhancer, which is a special enhancer program, to read and process compiled .NET assemblies for adding persistence capability. The enhancer is called directly by Visual Studio during build time to process the .NET assemblies in your project. Sometimes if your FluentMetadataSource is not configured correctly (it is wrong), the enhancer won't be able to enhance your assemblies and errors will be thrown during compilation. For example, consider the following code snippet:

public class FluentModelMetadataSource : FluentMetadataSource
{
  protected override IList<MappingConfiguration> PrepareMapping()
  {
      IList<MappingConfiguration> configurations = null;
      MappingConfiguration<Product> productConfiguration = new MappingConfiguration<Product>();
      configurations.Add(productConfiguration);
      return configurations;
  }
}
Public Class FluentModelMetadataSource
 Inherits FluentMetadataSource
 Protected Overrides Function PrepareMapping() As IList(Of MappingConfiguration)
  Dim configurations As IList(Of MappingConfiguration) = Nothing
  Dim productConfiguration As New MappingConfiguration(Of Product)()
  configurations.Add(productConfiguration)
  Return configurations
 End Function
End Class

Note that the preparedConfigurations collection is not initialized (it is set to null). If the Telerik Data Access Enhancer is integrated in your project, you will get the following compilation error: System.NullReferenceException: Object reference not set to an instance of an object. One possible action in that situation is to remove (decouple) the Telerik Data Access Enhancer from your project, and try to debug the PrepareMapping method.