i want something like this :
public class Order
{
public Guid OrderID { get; set; }
public Guid UserId { get; set; }
public DateTime OrderDate { get; set; }
public decimal Amount { get; set; }
public virtual ICollection<OrderDetail> orderDetailByOrderID { get; set; }
public virtual MembershipUser userByOrderID { get; }
}
so from above code i want membership user to be access from Order object ….
however i tried it but its not working.
so please suggest some solution if you have come across this type situation
It sounds like you might be using Entity Framework Code First. If this is the case you’d probably want:
public virtual aspnet_Membership userByOrderID { get; set; }instead of
public virtual MembershipUser userByOrderID { get; }That would grab the
aspnet_Membershipentity that is tied to theUserIdforeign key. Theaspnet_Membershipclass is not quite the same as theMembershipUserentity, but they have many of the same properties.If that won’t work, you can always use your
Ordermodel as is, and generate a ViewModel that has theMembershipUserobject.and create the ViewModel like this before passing it into a view