Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

update linq mapping?

Posted on 2013-01-03
5
Medium Priority
?
413 Views
Last Modified: 2013-01-10
I made a change to a stored proc, and now this code is complaining:

Procedure or function 'AgentFormList_Get' expects parameter '@ClientID', which was not supplied.

The error is valid, there are a few more parameters to supply after I updated the stored proc.  Do I edit this DataContext form code manually?  It looks like it was computer generated.

		[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.AgentFormList_Get")]
		public ISingleResult<AgentFormList_GetResult> AgentFormList_Get([global::System.Data.Linq.Mapping.ParameterAttribute(Name="AssetID", DbType="Int")] System.Nullable<int> assetID, [global::System.Data.Linq.Mapping.ParameterAttribute(Name="AssetSID", DbType="Int")] System.Nullable<int> assetSID)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), assetID, assetSID);
			return ((ISingleResult<AgentFormList_GetResult>)(result.ReturnValue));
		}
		

Open in new window



I've not done much with LINQ.

How do I get everything updated so that LINQ uses the updated stored procedure, etc?
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:armchang
ID: 38741707
From what I've known, this procedure was done through SQLMetal. It's  a command-line tool called SQLMetal that generates entity classes, properties, and associations automatically.

You can use that tool to regenerate the stored procedure you've made some update by running the SQLMetal tool on the database.

To get you started, you can run this on the SQLMetal tool: (By the way, I found my SQLMetal.exe file in this location: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools)

sqlmetal /server:pc-ferracchiati /DATABASE:People /user:sa
         /password:sapass /sprocs /code:People.cs

Open in new window

Change the server, database, username & password accordingly.

To give you an idea on how to use the SQLMetal tool, follow this: SQLMetal tool guide

Tell me how it goes.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 38741730
I have the same directory path:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools

How can I know for sure if the file was generated using SQLMetal or some other way?
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 38741733
Is there a way to do this through the Visual Studio IDE (the GUI environement) instead of via the command line?
0
 
LVL 7

Accepted Solution

by:
armchang earned 2000 total points
ID: 38742078
How can I know for sure if the file was generated using SQLMetal or some other way?
You will know if it was when you'll try to compare the generated results of the file based on the parameter /code:"filename.cs" to the one you have.

Is there a way to do this through the Visual Studio IDE (the GUI environement) instead of via the command line?
Yes there is. First of all, create a batch file to execute the SQLMetal command passing in server, database, user, password parameters required for the program. Second, there is a step by step process that you can add into your Visual Studio IDE to automate the task:

http://stackoverflow.com/questions/5605885/visual-studio-2010-how-to-run-a-bat-from-inside-the-ide

A
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 38742140
Thank you for this information.

I managed to get a hold of one of the other developers and asked him their process for updating LINQ / datacontext etc.

Here are the steps he gave me:

1)  Double-click on the .dbml file
2)  When it opens, delete the existing data class.
3)  Open the Server Explorer
4)  Find the modified Stored Proc
5)  Drag it over to the list of data classes

This will update everthing so that if there are more (or fewer) params expected this will get updated everywhere.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question