Problem with generating association inside dbml file for LINQ to SQL

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.

时间: 2024-10-07 23:07:33

Problem with generating association inside dbml file for LINQ to SQL的相关文章

a helper class for generating xls or csv file

using System;using System.Collections.Generic;using System.Linq;using System.Text;using Microsoft.Office.Interop.Excel; namespace Reuters.ProcessQuality.ContentAuto.Lib{ public class XlsOrCsvUtil { /// <summary> /// Generate Xls Or Csv File /// <

Update files embedded inside CAB file.

References: https://community.flexerasoftware.com/showthread.php?182791-Replace-a-single-file-embedded-in-an-MSI Windows Installer Scripting Examples WiFilVer.vbs : Manage File Sizes and Versions WiMakCab.vbs: Generate File Cabinet @ECHO administrati

Windows Phone本地数据库(SQLCE):5、[Association]attribute(翻译)(转)

这是“windows phone mango本地数据库(sqlce)”系列短片文章的第五篇. 为了让你开始在Windows Phone Mango中使用数据库,这一系列短片文章将覆盖所有你需要知道的知识点. 我将谈谈在windows phone mango本地数据库时使用[Association] attribute. 首先.要说到的是,windows phone 7.1上的数据库功能是SQL Compact关于Mango的一个实现.你将使用linq to sql访问存储在数据库上的数据. 1.

CRM之菜单管理(二)

四.文件及函数 1.文件说明 (1)LQMenu.dbml:创建Linq To SQL类,使其对应数据库中的core_menu表 (2)MyFuncLib.cs:常见的公共函数类,将系统中经常用到的公共的函数放入其中 (3)BLMenu.cs:对LQMenu.dbml的数据操作层,用于存放数据增删改查函数,及其他与数据库有关的函数 (4)FormMenu.cs:窗体的主函数 2.FormMenu_Load函数 使用InitDgv函数来初始化DataGridView,当需要修改的时候可以直接在代码

Extension of write anywhere file system layout

A file system layout apportions an underlying physical volume into one or more virtual volumes (vvols) of a storage system. The underlying physical volume is an aggregate comprising one or more groups of disks, such as RAID groups, of the storage sys

FAILED TO DO DATA ASSOCIATION FOR OES DOMAIN(ORA_01017)

Error log:Problem Description-------------------1.Prepare DatabaseRun the RCU utilityCreate Prefix: DEVSelect:IdentityManagement->Oracle Adaptive Access ManagerIdentityManagement->Oracle Access Manager2.Install IDM Suite3:Configure IDM Suite4.Config

XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 Problem D. Clones and Treasures

题目:Problem D. Clones and TreasuresInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 256 mebibytesThe magical treasury consists of n sequential rooms. Due to construction of treasury its impossible togo from room

Unexpected exception &#39;Cannot run program ... error=2, No such file or directory&#39; ... adb&#39;

Eclipse ADT Unexpected exception 'Cannot run program' up vote 8 down vote favorite 4 I have installed ADT Bundle on my laptop. I have ubuntu 13.10 but when I open the ADT I see this message: Unexpected exception 'Cannot run program "/home/.../Descarg

How to solve &quot;one or more projects in the solution were not loaded correctly&quot; problem?

/*By Dylan SUN*/ When building an enterprise application, there could have a lot of projects in one solution. And several developers create new projects to meet the business requirement. And also some re-factorization could be undertaking at the same