Solved

update linq mapping?

Posted on 2013-01-03
5
391 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 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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