Visual Studio Tool to update a DBML? [duplicate] - c#

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to update Linq to SQL dbml file?
Is there a quick command in VS2008 to update a DBML that I'm missing or do I have to dleete everything, re-add and then deal with renames and table mods manually? This seems a bit tedious.

DBML so LINQ to SQL; you can delete and re-add a table as one option; that's what we do in our app... curious if there is a better way, but this works quick so that's what we do. THe drop down in the properties window is a quick selector for the table, and we delete, and then bring in the changed table, and it recreates the fields/relationships.
THere isn't an update model from DB like in ADO.NET entity framework.

Related

How to make Microsoft Entity Framework 6.0 bulk update/delete faster? [duplicate]

This question already has answers here:
How to Bulk Update records in Entity Framework?
(9 answers)
Closed 2 years ago.
In my ASP.NET application I am using Entity Framework 6 with SQL Server. As per my scenario I need to perform a bulk update (40k row at a time) and bulk delete operation (40k row at a time) with EF6. EF6's RemoveRange method seems very very slow and update takes forever. Is there any way to speed this up?
you should try a stored procedure to delete the items, stored procedures are much faster and pre-compiled form stored in SQL Server.
for reference to work with Stored Procedure please visit the link.
Stored Procedure with Entity Framework

I can't drop table in SQL even after tried all the methods I found on the Internet [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I can't drop an SQL table even after I tried everything I found on the web. I actually want to delete and recreate an SQL table after clicking the "SAVE" button in my C# app (a simple SQL database editor). It works fine for tables with just data (no special rules like primary keys, forbidden nulls, etc.) but for more complicated ones I call a delete function (DROP TABLE table1), then a CREATE TABLE table1 ..., it throws an error "There is already an object named 'table1' in the database". Can anyone help? Thanks in advance!
i think your issue the tables didn't drop. since there is a relationship between tables.
So if the table you doping is a FK to other table , it will not go through.
try DeleteRule = Cascade.

Entity Framework poor performance on SaveChanges in large batch job [duplicate]

This question already has answers here:
Fastest Way of Inserting in Entity Framework
(32 answers)
Closed 6 years ago.
We have a requirement to read a load of xml files, run validation on them, transform them into entities and stores them in the database. This was being done using a repository wrapping Entity Framework.
What we have found is that Entity Framework slows the process down to the point where it doesn't process the records quickly enough. We profiled the application and the worst performing method was the SaveChanges on the EF context.
We are thinking of introducing threading as a possible solution.
Has anyone any other ideas of how we can speed up the process?
I had this problem for csv files one time. The problem was that I tried to save all my records with only one SaveChanges() because transaction was required.
I divided it (1 for 1000 records) and it resolves my performance problem.
Also, you can try to disable auto detect changes during your threatment.
I hope it helps :)

Using linq to select all tables in database [duplicate]

This question already has answers here:
Linq: Get a list of all tables within DataContext
(4 answers)
Closed 8 years ago.
I want to select list of all tables (Not columns) in a database using LINQ dynamically.
I just want it Dynamically not what listed in DataContext static values.For example i alter Table2 after deploying program. in this situation how i should find it.
By the way of there are any query also please let me know.
I think you can use the "Mapping" feature of LINQ:
context.Mapping.GetTables();
if you want to get tables that are modeled you can use #Mygyll answer, but if you want to list all tables in database you can use SMO, in smo when you have a database you can get all tables via this code
db.Tables.Cast<Table>()

Is there a get-or-create (lazy loading?) idiom in SQL? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Solutions for INSERT OR UPDATE on SQL Server
Check if a row exists, otherwise insert
I'm using SQL Server 2008 R2, C# .NET 4.0 (and LINQ).
I want to get or create a row in a table and then append a string to one of its columns.
I'm wondering if there's a best practice for this kind of idiom, or if SQL offers this out of the box?
Somehow transaction start -> select -> insert or update -> transaction end doesn't seem elegant enough...

Categories