Add only required stored procedures to EDMX - c#

I have two newly created stored procedures in my database. I tried to import those two stored procedures by going to Model Browser -> Function Imports -> Update Model from Database -> Add (tab) -> Selecting the newly created stored procedures under Stored Procedures and Functions -> dbo and clicking Finish button.
Note: I have checked 'Import Selected Stored Procedures and functions into the entity model' option.
The above step helped in adding the required stored procedures into my model/edmx.
But the problem I am facing is, it is also updating the other tables where there are few changes to one of the table where few columns were deleted in some table. This table has nothing to do with the stored procedures that I am importing. But it is asking me to update that table as well even though I have selected only the stored procedures.
Can someone please help me out why is this checking other tables which are not related to my newly added stored procedures even though I have selected to import only those stored procedures? how can I avoid other changes which are not relevant to my stored procedures?

Related

Why my complex types is not updated when i add a stored procedure into edmx in Visual Studio 2017?

I'm using the Entity Framework to create a complex types from some stored procedures. Now, I changed one of the stored procedure to display 2 more fields.
I'm trying to update the complex type that maps to this stored procedure, but it's not working! Also, I tried both approaches:
Delete all 3 parts in model, and add again
Update the Model from the database and then update function imports
but they did not work!
Also, in the first way, when I add the stored procedure to the model, the complex type isn't updated. Besides, in the second way, when I "Edit Function Imports" and "Get Column Information", I get a message
The selected stored procedure or function returns no columns
while it's returning about 30 columns through a select statement!
The last part of my stored procedure is like this:
select *
from MyTable
where Name like '%My Name%'
This problem happened with me when I update the EDMX from existing database, but I solve it through:
Check the output of stored procedure in your database.
Do this steps:
Delete the EDMX.
Delete the connection string in app.config , save app.config and close app.config.
Clean the project.
Add EDMX again.
Rebuild the project.
hope this fix the problem.

Disabling triggers to insert record in a table may result delay, how to manage it?

I am working on integration project that deal with manufacturing database, my project is using C# and SQL Server, I use a stored procedure to insert.
The main table for transactions has already big number of triggers that are used to do many functions including updating other tables.
I can not insert into this table only if I disable the triggers, now I am doing that using C# that ask another stored procedure uspDisableAllTrigger to do this.
The question is should I merge the two stored procedures (disable and insert stored procedures) into one stored procedure, or I keep it two stored procedures and call them from C# code?
Mainly I care about performance and delay (as delay may result inconsistency of data and the updating triggers will be disabled for some time)

Entity Framework Database first add parameter to stored procedure

I am using Entity Framework 5.
I have a stored procedure that was added to the model some time ago. Now i have add a new parameter. I tried using "Update Model From Database..." but it doesn't add the new paramerter to the c# generated code.
In the edit menu of the stored procedure from the model browser tab all i could find was to update the columns that the stored procedure returns.
Is there any way of refreshing the parameters that the stored procedure expects without removing the stored procedure from the model and then adding it again?
The solution is following:
1) In your .edmx, right-click and select Model Browser.
2)Find Function Imports, expand it and double-click your stored procedure.
3)Click the Update button.
4)Click ok and save your .edmx to reflect changes in your project.

Entity Framework function import is not refreshing changes

I deleted a stored procedure from the database, then trying to update the entity framework model, and I see Stored procedure / functions have been updated, but the function imports didn't.
Below is the image explaining the problem
Currently, I am doing this way:
1. Delete the stored procedure from database
2. Run the EF update wizard
3. Go to Function Imports folder
4. Delete the stored procedure
5. Go to Complex Types
6. Delete the complex type
How to fix this ?

Stored procedures and functions is not updating for Entity Model

I work with database first Entity Framework & LINQ in Visual Studio 2013.
When i write stored procedures and change them, i used to update Entity Data Model from database by choosing stored procedure updating option.
It is weird that the 'import selected stored procedures and functions into the entity model' option comes disabled so I cannot choose stored procedures and functions for updating model anymore..
Can you please help me to find the problem?
You only have to import stored procedure and functions into the model when they're new. So when there are no new ones the option is disabled.
This doesn't mean that, as you seem to suspect, EF doesn't update existing stored procedures and functions. It does.

Categories