Hi , wondering if anyone has any ideas to this within my class mapping. I think the answer maybe in my db structure.
Anyway, all thoughts very much appreciated.
Invalid association mapping for member 'Asset.DesignImages'. 'DesignImage' is not an entity
I've notice VS studio is giving me warnings:
Warning 1 Value for property "Discriminator Property" cannot be empty. 0 0
Warning 2 Value for property "Inheritance Default" cannot be empty. 0 0
My DataBase
Asset
DesignText (foreignkey to asset.id )
DesignImage (foreignkey to asset.id )
Maybe i'm gettng nulls???
var query =
from d in db.Designs
from a in db.Assets
select new ProductViewHelper()
{
theDesign = new Design(){DesignId = d.Id, Title = d.Title, DateField = DateTime.Now, PreviewImage = d.PreviewImage},
theAsset = new Asset(){AssetId = a.Id, DesignId = a.DesignId, Date = a.Date},
DesignTexts = (from x in a.DesignTexts select new DesignText()
{ DesignTextId = x.Id, Text = x.Text}).ToList(),
DesignImages = (from y in a.DesignImages select new DesignImage()
This is because the DesignImage table does not have a primary key. Entities are unique objects that need a descriminating key. So, either remove the relationship or add a primary key to the table.
anthonyplane...
Member
74 Points
48 Posts
invalid association mapping
Jul 29, 2008 06:58 PM|LINK
Anyway, all thoughts very much appreciated.
Invalid association mapping for member 'Asset.DesignImages'. 'DesignImage' is not an entity
I've notice VS studio is giving me warnings:Warning 1 Value for property "Discriminator Property" cannot be empty. 0 0
Warning 2 Value for property "Inheritance Default" cannot be empty. 0 0
My DataBase
Asset
DesignText (foreignkey to asset.id )
DesignImage (foreignkey to asset.id )
Maybe i'm gettng nulls???
var query =
from d in db.Designs
from a in db.Assets
select new ProductViewHelper()
{
theDesign = new Design(){DesignId = d.Id, Title = d.Title, DateField = DateTime.Now, PreviewImage = d.PreviewImage},
theAsset = new Asset(){AssetId = a.Id, DesignId = a.DesignId, Date = a.Date},
DesignTexts = (from x in a.DesignTexts select new DesignText()
{ DesignTextId = x.Id, Text = x.Text}).ToList(),
DesignImages = (from y in a.DesignImages select new DesignImage()
{Id = y.Id}).ToList()
};
foreach (var p in query)
{
Response.Write(p.theAsset.id);
}
pharcyde
Member
538 Points
109 Posts
Re: invalid association mapping
Jul 06, 2009 02:07 PM|LINK
.NET Developer and MVC Advocate