Hot answers tagged

6

I would like to point out that Entity Framework (full name: ADO.NET Entity Framework) is an ORM (Object Relational Mapper) that uses ADO.NET under the hood for connecting to the database. So the question "should we use ADO.NET or EF?" doesn't really make sense in that respect. Unless you re-architect your application, adding EF to the mix is simply adding ...


4

This is going to be a frame challenge answer. It is possible to design base class in a way that I have to pass connection string only once and not for each of the 4 concrete classes? You shouldn't try to achieve what you want to with a base class. Why not? Basically, if you use a base class for this, it might work fine now. Over time, your code will ...


3

There are several statements in your question that are not correct and once clarified should answer your question: But for Inserts, normally a duplicate row exception would be thrown on unique index values. So the Insert throws an exception and the Update / Delete does not. But it still amounts to "concurrent changes to the data" no matter how they might ...


3

Should I just dispense with the binding source and work with the DataTable object directly That at least will basically solve your whole problem. Use your UI labels for displaying things only, not for providing input values for further calculations. What would you do, for example, if you get a requirement to change the formatting of the cost label, to, ...


3

If you are looking for performance stay away from EF. It is the slowest ORM out there and uses a lot of memory to keep the database metadata. Most benchmarks out there show that -


3

Reading DataTable across multiple threads should be OK . Writing is not, you should synchronize write access. See "Thread Safety" in Data Table doc. Might need to create a separate object that deals with data access and synchronization. At the most basic though, you could just call lock(table) {//Write here} before you write the data in every thread. ...


3

You wouldn't get any improvement if you pass an instance of the DataTable to each instance of MyClass, you still have a single DataTable instance every object refer to, and will use a bit more memory because each object will have that instance unlike a static field that is a single reference for the hole class. For the first view, you shouldn't have any ...


3

Entity Framework does have a warm up time but it's a couple of seconds. 3-5 minutes suggests something seriously wrong with your queries. You should use something like Linqpad to see what SQL your LINQ to Entities is generating and work at optimizing it. Assuming of course you have done some troubleshooting and worked out that the DAL is your problem area. ...


3

You say you are calling a "lot of stored procedures". If every call includes a seperate trip to the database, that is your performance issue, because trips to the database are always expensive, no matter what they do. You should have one stored procedure to save a transaction. If that procedure has to call other procedures, fine, as long as you don't have ...


3

You will have to use LINQ and EF together if you want to do anything more complicated than CRUD with EF. That said, EF makes CRUD dirt simple. Build your models or database, push the changes the other way (update the database or your models respectively), add controllers and views to taste. If you start getting into more complicated objects than can be ...


2

Feel free to downvote since ORMs seem popular these days, but... WHY are you using Entity Framework? Is there a possibility that the backend database might change? Are you nervous about writing SQL stored procedures to deliver your data? Or possibly does it seem that writing a lot of transforms from DbDataReader rows to your objects might be a lot of ...


2

Opting to load everything into memory on start up is a premature optimization. You haven't collected statistics on how long it takes to query, determined if some caching is going to speed things up more than your indexes etc. To answer your specific questions: Wouldn't this increase the query-count drastically? That depends on your definition of ...


2

You have to see these elements as layers of a cake. ASP .Net WebForms or ASP .Net MVC is the top layer of the cake, namely the user interface layer. This, ideally, should handle the user's browsing and pass anything more complicated than that off to the business logic. The next layer down, the middle of the cake, is the 'business logic', where you'd set ...


1

I don't think a return of zero rows is necessarily an exception or an error in any case of insert, update, delete or select. I've never had a need to treat it that way. In the case of cleaning up data, I may want to update a field that is null and just because they all have a value, why is that an exception? It could be a good query or a bad query as far as ...


1

It sounds like you are trying to model a set of disparate data sources as a single model. If that is indeed the case, my opinion is that creating a project to make the abstraction is the way to go. I say that because you are dealing with different TYPES of sources. For example, if you just had two databases you could put a link between them, and abstract ...


1

Just in case you're interested, you can resort to MySQL instead of SQL Server. The MySQL Connector/Net has a WinRT component (DLL) you can reference from your WinRT/UAP Application in order to access a MySQL database. Syntax is similar to "regular" ADO.Net and it's really easy to use. In case you hold the database in your same machine, you have to enable "...


1

WinRT has NO system.data and that has been confirmed by Microsoft. System.data has ADO and SQLclient. No direct connect to SQL from WinRT. Need to get data from a service.


Only top voted, non community-wiki answers of a minimum length are eligible