码迷,mamicode.com
首页 > 数据库 > 详细

Problem with generating association inside dbml file for LINQ to SQL

时间:2015-04-16 17:27:44      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

Question:

I have created a dbml file in my project, and then dragged two tables from a database into the designer. This is the tables for order header and order lines, and order lines have a foreign key to order header to make it a one to many relationship.

As soon as the two tables are dragged onto the designer, the association arrow appear and everything looks correctly. In the properties for the association, Child Property is set to True, Access is public, Inheritance mode is (none), Name is OrderLines (originally taOrderLines, but edited by me to be called OrderLines.

The problem is that no OrderLines property is created. I checked manually in the generated cs file also, and neither the word OrderLines or Association is found there.

What am I doing wrong here?

 

Answer:

If your objects don‘t have a Primary Key property in the dbml, LinqToSql object tracking can‘t see those objects and relational properties will not be generated.

Problem with generating association inside dbml file for LINQ to SQL

标签:

原文地址:http://www.cnblogs.com/facial/p/4432526.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!