Page 1 of 1

Unmapped Class Member error - One-To-Many Relationship

Posted: Wed 21 Dec 2011 18:30
by bichuete
Hi,

We have the following entities:

-Account:
*Id - Guid
*Data - String

-Logins:
*Id - Guid
*AccountId - Guid
*Sucess - bool

It's not strctly like this but it's enough for explanation of the error. I'm creating like this (Accounts is abstract for several entities):

Create var of accountType (it insert alone correctly and same for login, but when inserting then in same context it throws errors).

var login = new Login() { Id = Guid.NewGuid(), Time = DateTime.Now, IP = "0.0.0.0" };
login.Account = accountType1;
context.Logins.InsertOnSubmit(login);
context.SubmitChanges();

It throws error Unmapped classmember Account, Logins.

Posted: Thu 22 Dec 2011 14:58
by StanislavK
Generally, this exception specifies that the mapping provided for your DataContext class has no information about the Account.Logins navigation property. Could you please specify the following:
- the definitions of the Account and Login classes;
- the mapping mode (attribute, file, or fluent) you are using for them;
- the stack trace of the exception.
If possible, please send us a model with which the problem can be reproduced.