.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

LinqToSql association

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net


In my web application based on Dynamic Data I use LinqToSql database model (.dbml).

I have some tables, that I can not include in sql server database diagram and draw relation.

But that tables are actually lookup tables for some other table column value.

So I added association in my LinqToSql model manually, but it doesn't work.

What would be a solution for my kind of problem?


Thanks in advance,


View Complete Post

More Related Resource Links

Association creation error


In the dbml Designer surface in VS2010, I am associating two views from a database which I am only granted for View access. 

The View1 has 
  Site (smallint, not null)
  LocationID (int, not null)

The View2 has
  Site (int, not null)
  LocationID (int, not null)

Due to the incompatible types between this two, the association can not be created.  Is there other way to create the association, such as cast(View1.Site as int) in the assocation?

How do you create an association between two different data sources in BDC web parts?



I have a SQL Server database with the customer details and an authenticated web service providing contact details of the selected customer.  How do i connect them using web part connections to retrieve and display the data.

Or is it possible to create a Primary key-Foreign Key relationship between two tables in different databases with a common column?



checkboxlist full post back problem is association with PopupControlExtender


I have used a checkboxlist in association with PopupControlExtender. All the items are inside the update panel. I used the server side SelectedIndex changed event of checkbox list for another purpose.  But it cause full post back while checking the check box item. The update panel doent make any sense here.

        <asp:ScriptManager ID="Scriptmanager1" runat="server">
        <asp:UpdatePanel ID="UpdatePanel3" runat="server">

Extracting Association Rules from Data Mining Model

Hi I have succesfully created a Data Mining Model using the Association Model. I have deployed and processed it. I need to extract all the rules that is generated by the model. I know that you normally query the model using DMX prediction queries, but in this case I need to extract the rules to a separate table for further processing. I have tried the following approaches unsuccessfully: 1. Linked server in MSSQL Management Studio. DMX query using OpenQuery. The DMX query looks like this: SELECT FLATTENED NODE_CAPTION, NODE_SUPPORT, NODE_PROBABILITY, MSOLAP_NODE_SCORE FROM DataMiningModel.CONTENT WHERE NODE_TYPE = 8   On small models this method works. On larger models with many rules I receive an exception: "XML for Analysis parser: The XML for Analysis request timed out" before it was completed This always happens after 70min. I might have missed a timeout option? 2. Using SSIS to run the same DMX query as above. The method is presented here: http://www.sqlservercentral.com/articles/MDX/64697/ This method works on small models. On larger models that did not work with method 1, it return rules. The number of rules returned is sometimes different for the same package run multiple times. For the largest models it simply returns 0 rules. I suspect that the same XML Parser error happens under the hood of SSIS. I'm currently stuck, and need some inp

Custom List Row association to multiple documents - Design choices?

I want to associate custom list entries to muliple documents. Thinking about options.   1 row will have many docs, but one doc will only have one row. Possible? Trying to keep it simple with minimal development. I was thinking I could have a unique column or the id column in the list act like a key (somehow).. and  add a required column to the document list requiring it to tie back to the list entry.  Then a view could drive listing all the docs for a particular row from a link in the list built in a custom dataview. All the docs could be in the same library. Is the the best approach? Ideas/suggestions? Thanks.

What registry keys are responsible for file extension association?

I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

Entity Framework : implemeting very simple association scenario

I want to implement the below mentioned problem in Entity Framework.    I have 2 tables( below are their simplified versions)    items table    itemId,itemNametags table    tagId,tagName    - my logic is, an item can have more than one tag and a tag can have more than one item related to it, so I have added many to many relation (please correct me here, if I am wrong)- I have created model (edmx file) and database from it.- I have written code for adding data to my sample tables, and its working fine. Below is sample data            itemId  itemName  ---items table           1   |  fish           2   |  cell phone            tagId    tagName ------tags table           1   |  eatable           2   |  electronics           3   |  non vegI need to know how to write these 3 queries    1. add relation between tag and item e.g. add tags "eatables&qu

Add a filter to an association

I have a 1:M relationship between Contact and EmploymentHistory. I want to create a new association that is the current employment, which would be 1:1 so I can do Contact.CurrentEmployment. The EmploymentHistory table has a CurrentEmployment flag. Is there a way to do this in Entity Framework?    

Linq to SQL - Association Property Name problem

Is it possible to specifiy a custom property name for a foreign key association in Linq to Sql? For example, if you have an "Order" class that has a "Customer" EntityRef, that's fine.  But what if instead of myOrder.Customer you wanted the property name to be myOrder.PreferredCustomer.sqlmetal and the designer are both always using the table name as the Property name.  So myOrder.Customer is the only option I have, other than hacking through the generated file.You can change the storage option of the association attribute, but that pertains to the underlying member, NOT the public property.Thanks.

BDC, external list with many-to-many Association, how to input data

Hi, I have built a BDC with VS2010 and Sharepoint Enterprise as target platform. It is basically a technical evaluation about many-to-many Associations in external content types. Its has 2 entities which are Person and Ticket and should reflect a data model where persons can work on multiple tickets and tickets can also involve multiple persons. For linking those 2 entities I have a link table which can be read via the "Navigators" and be modified via the "Associator/Disassociator". I made the model completely with the VS2010 bdcm designer and as far as I know its good. (Its a "foreign key less" association, the identifiers are UInt32.) Now my question is how do I actually use those manipulators, or at least show data and related data. With 1-to-n relations Sharepoint did render an interface for handling the relation for me, but with a keyless n-to-m relation I dont get any interface for connecting the entities at all. Then I tried to make this via Infopath, but as far as I can tell, you cant use a 2nd datasource there with external List. (And it seems to be supposed to be this way.)

Binding a treeview to a LinqToSQL class...


Hi all,

I have a LinQtoSQL class which encapsulates a table with the following relationship:

Id (int)
Parent ID(int)
Name (string)

Here, the parent ID is the id of another row int he same table. So, the table could look like:

1, null, grandpa
2,1, mom

What I want to do is the create a treeview that binds to the table so that it looks like this:


Also, I should be able to add or delete nodes/rows...

Any ideas on how to do this? Is this even possible without writing the code to do all the population and the edit etc?





SPList.WorkflowManager.StartWorkflow(SPItem item, SPWorkflowAssociation association, string initiati

I want to know initiationData Data format in this method  please help me .I want send some integer to workflow but I dont know initiation data format.??

Problems when deploying sequential workflow with association Infopath form of sharepoint 2010 using


I’ve create a workflow project with infopath in it. And I get the error

 “Error occurred in deployment step 'Activate Features': Unable to locate the workflow's association data. To restore the association data to the workflow, restart the workflow settings wizard by selecting the workflow node in Solution Explorer and then clicking the ellipsis button (…) on one of the properties in the Properties window that has an ellipsis button.”

I'd really appreciate of any help.

Association rules dimension error caused by setting the model algorithm



I got this error meassage when I wanted to process a mined cube:

"Error (Data mining): An error occurred while the 'Bon_DMDim' data mining dimension with the 'Bon' source mining model was being processed. The algorithm of the source model returned data mining dimension content information that is not valid."

Before processing I modified only one algorithm parameter in the Association Mining model properties (AlgorithmParameters):

MINIMUM_SUPPORT = 10 (Default 0.0)

I need to have this adjustment for getting rules...

If I set back this field to 0 or empty, then the processing ends up with no error messages (and I would not have mined rules...).

I also get this message, if I use numbers between 0 and 1 (as a percentage).

How can I build a usable (but with adjusted algorithm parameter) mined dimension and apply it in an OLAP cube?

Thank you and BR,



Association Columns - Reusable Workflow


I have created a reusable workflow and added the site columns that I needed via the ‘Association Columns’ tab.  I have saved and published the workflow successfully.

I then realised that I needed to add more site columns, which I did in the same manner that I did previously.  I do get a warning at this point ‘Changing the association columns for this workflow can cause new instances of existing associations to fail’.

When I try to save the form I get the following error ‘Some association columns defined in this workflow are no longer valid.  This error may occur if the corresponding site columns have been deleted.  To fix the workflow, delete and recreate the affected columns’.

how to Reverse Association?


I'm trying to have a relationship N to N. For that I am using what is said here: http://blogs.msdn.com/b/bcs/archive/2010/01/15/tooling-associations-in-sharepoint-designer-2010.aspx

But I can not create the Reverse Assoaciation ... someone has done you can tell me how?


Use and Deployment of LINQtoSQL


Hi All;

  I'm quite inexperienced with .NET as a whole and would like a bit of guidance and pointing in the right


I'm developing a new website however, based on what I've read, I'm also using LINQ to SQL and Custom Server

Controls.  The basic infrastructure is this:

I'm using SPROCS to do all CRUD operations.

I've got 2 projects, the first contains 2 LINQtoSQL files which encapsulate all my SPROCS.  I use 2 LINQtoSQL files

because I'm using 2 different connections (strings) to connect to 2 different DB's.  The second contains all my

custom server controls (which uses the LINQtoSQL project to access the DB.).

I then have a website which uses both these 2 projects.

I however am being lead down the path of not using LINQtoSQL because we don't know:

1. How to successfully deploy the website with these two projects (.dll's) which use LINQtoSQL.

2. It is intended that the website (using these two projects (.dll's) will be deployed to multiple (physical) servers. What will be the ramifications of this? Will this make deployment and maintenance more difficult?  How would that be gone about?

If anyone can point me in the right direction, that'd be highly appreciated.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend