Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

If you get the specification for the property at the other side of a relation wrong, the compiler will not warn you, but dbschema.exe will complain with this error message:

Execution aborted. Exception stack:
Remotion.Data.DomainObjects.Mapping.MappingException: Opposite relation 
property 'PhoneNumber' could not be found on type 'PhoneBook.Domain.Person'.
Declaring type: PhoneBook.Domain.PhoneNumber, property: Person

This happens if you write, for example, "PhoneNumber" instead of "PhoneNumbers" in the DBBidirectonalAttribute parameter for the opposite property:

// Wrong: "PhoneNumber" instead of "PhoneNumber*s*" -- typo goes 
// undetected by compiler
[DBBidirectionalRelation("PhoneNumber")]
public virtual Person Person { get; set; }
// -> Missing DBBidirectionalRelation attribute error
  • No labels