This is a migrated thread and some comments may be shown as answers.

a compilation error

1 Answer 25 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vitaliy
Top achievements
Rank 1
Vitaliy asked on 11 Mar 2016, 06:26 PM

I've got an exception when tried to compile my project:

Object reference not set to an instance of an object.
ExceptionString:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.OpenAccess.Metadata.Fluent.SimpleForeignKeyAssociationFactory.CreateForeignKeyColumn(MetaPersistentType sourceType)
   at Telerik.OpenAccess.Metadata.Fluent.SimpleForeignKeyAssociationFactory.CreateMetaAssociationObject()
   at Telerik.OpenAccess.Metadata.Fluent.AssociationItemFactory.CreateMetaAssociation()
   at Telerik.OpenAccess.Metadata.Fluent.NavigationPropertyConfiguration.CreateAssociation(AssociationItemFactory associationItemFactory, MetaType persistentType)
   at Telerik.OpenAccess.Metadata.Fluent.NavigationPropertyConfiguration.CreateConceptualItem(FluentMetadataSource fluentMappingSource, MetaType persistentType)
   at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.AddConceptualItem(FluentMetadataSource fluentMappingSource, MetaType persistentType)
   at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.AddMasterAssociationMapping(FluentMetadataSource fluentMappingSource, MetadataContainer metadataContainer)
   at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.ProcessAssociations(MetadataContainer metadataContainer)
   at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.CreateModel()
   at DataDomain.FluentMapping.PMSMetadataSource.CreateModel() in C:\dev\PMS_VS2015_NewTelerikDataAccess\DataDomain\FluentMapping\PMSMetadataSource.cs:line 23
   at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.GetModelCore(MetadataContainer old)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()DataDomainC:\dev\PMS_VS2015_NewTelerikDataAccess\DataDomain\obj\Debug\DataDomain.dll

 

using System;
using Telerik.OpenAccess.Metadata;
using Telerik.OpenAccess.Metadata.Fluent;
 
namespace DataDomain.Property
{
    public class LettingLeasing
    {
        public static MappingConfiguration GetMapping()
        {
            var cfg = new MappingConfiguration<LettingLeasing>();
            cfg.MapType().UseDefaultMap().ToTable("LEASEASSIGNMENT");
            cfg.HasProperty(c => c.ID).IsIdentity(KeyGenerator.Autoinc);
            cfg.HasAssociation(c => c.NewAlternativeBillingAddress).ToColumn("NewTenantABA"); // <==== THIS ROW CAUSED THIS
            return cfg;
        }
 
        public int ID { get; private set; }
        public DateTime? DisplayUntil { get; set; }
        public PMSAlternativeBillingAddress NewAlternativeBillingAddress { get; set; }
    }
}

 

1 Answer, 1 is accepted

Sort by
0
Vitaliy
Top achievements
Rank 1
answered on 11 Mar 2016, 11:25 PM

Oh, yeah, I made a mistake.

Mapped two classes to the same table - 'LEASEASSIGNMENT' and associated their two properties to the same column name 'NewTenantABA'.

An user friendly exception would be better though.

 

Tags
Development (API, general questions)
Asked by
Vitaliy
Top achievements
Rank 1
Answers by
Vitaliy
Top achievements
Rank 1
Share this question
or