Solved

update linq mapping?

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

617 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