To use DataSets or not. What to do? [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am writing a small c# database application that will store sports statistics. There will be about 7 tables in the local sdf file that will store the data. One table for storing the player details, another table to store the game info and another table that will store the the actual stats from the game using the playerid and gameid as foreign keys. I personally see this as a small database as it will only grow by about 30 entries per week. The end result of this is to be about to pull reports out of the collected stats.
I am a little confused as to which way to access the data in the database. Datasets look ok, but when i want queries to access multiple tables or use the WHERE function in the query, things get a little troublesome. I was thinking of just directly accessing the database with out the need for datasets.
Opinions on the best options are appreciated.
Thanks

Datasets area relatively old technology which is steadily being replaced by Entity Framework. For any new development looking for a standard Data Access technology, Entity Framework should be your primary solution. The Model-Based option feels a lot like DataSets in the designer (you can design your model by dragging tables and relationships to the surface), but Entity Framework can also work directly against your code (EF-CodeFirst) which many people find better, since you have total control over what your code will look like (plus it won't get overwritten each time you save the datamodel).
Unless you are open to 3rd party libraries, in which case there are a couple of great open source alternatives that include NHibernate and a few others.

Related

Data storage suggestions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
My very first post on this forum but I have a problem with choosing how to store the data that my website will generate.
Its a project I'm working on for my boss and its a Time/Project management tool written in ASP.NET
The system is supposed to track the amount of work hours each person spends on a project and store this data for a minimum of 3 years, Now I was thinking of going with SQL but I'm having doubts when it comes to fetching older data further ahead and with queries taking too long.
About 2500 entries per month with starting and ending time, the id of the person and an id for the project they have been working on.
What would be the best solution here?
Right now it's supposed to be for the company only but might go public further ahead and in that case would the same solution still hold?
Using Azure for hosting.
Thank you
A SQL database can handle millions of entries without a problem, don't worry about that. If performance issues should occur you could take a look at sql index, a way to improve lookup speed for a certain column, e.g. matching a name like in a nvarchar (..) column.
Any other storage solution is probably a lot slower and less maintainable in the future, especially since you need to store your data up to three years
Edit 1:
Also, like mentioned in the comments;
NoSQL database like Azure Table Storage / CosmosDB can perform very
well as well
That said, any database like approach will probably work.

Large SQL statement versus a few data calls [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have a web page where I need to get fields from many tables in SQL that can all join. Is it better in terms of performance to do a few queries to the database or one big SQL statement. I'm using MVC with Web API calls.
Thanks.
In the past I've created DB Views to define the data I'm looking for. Depending on the data access framework you are using this can also be helpful in returning the data and translating it to objects.
As far as performance goes, I'm most familiar with SQL Server, and in the Management Studio there is an option to "Include Actual Execution Plan". This will show you a full breakdown of your JOIN statements, what indexes are being used if any, and will suggest indexes to speed performance. I recommend this tool to all developers on my teams when they are stuck with a slow performing page.
One other thing to note, the database configuration also makes a difference. If you are running a local database you will have fewer concerns than if you were running a cloud based database (Azure SQL, etc) as those have management overhead beyond your control when it comes to availability and physical location of your instance at any given time.

Fastest Approach to Save and Read Data from Database in MVC [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am working on an application that needs to save and retrieve data fastly from database.I am using MVC5 razor view with C#.
Scenario may be like there is a post that can be like/unlike by any user and data will be store in database, also user can share that post. For example, facebook. on facebook we like/unlike posts and it is works very fast.
Can any one tell me which database tool**(Sql Server, MySql, Oracle etc)** should I use and which data approach**(Entity framework, Store Procedures, ORM, NoSql etc)** should I use in my scenario ?
Thanks in advance....
Selection of the database completely depends on you.
and it is also dependent on the cost as mysql is free of cost.
You have to identify your requirements and then need to select the database tool.
if you are only considering the speed then you need to read about Entity framework, Store Procedures, ORM, NoSql.
These are the different approaches used for differnt purpose
As Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language.
So it completely dendends on your requirement.
But first i will suggest you to read more about these concepts.
thses two links will definitely help you to understand more.
https://kevinlawry.wordpress.com/2012/08/07/why-i-avoid-stored-procedures-and-you-should-too/
http://www.davidwaynebaxter.com/tech/dev/orm-or-sprocs/

Which layer for a change saving method? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm developing my financial app for simple operations. But I need to be able to make note of any changes made to my records. I use C# ASP.NET for my application code and MS SQL 2014 for my DB.
My question is: which is better ?
Application Layer: write a method in code that creates a record in a history table in DB?
Database Layer: write trigger/procedure that creates a record in a history table in DB ?
My main concern is performance - the app is mounted on a IIS server in my home so i need to fine tune this so it will be lag-less for my users and doesn't put a big workload on my server.
This has a lot to do with preferences and maintainability.
For the sake of maintainability, I always go with the Layered approach, myself.
Here's an example why.
Let's say you have your SQL Inserts and updates scattered throughout the code. And then, one day, your database changes in such a way, that you would have to look up each and every one of those inserts and updates, and change all of them one by one.
For the sake of argument, you could also create one function that does all of these inserts and updates, and call that specific function every time from your app. That would work, but could become a clutter as you'll eventually end up with a lot of those functions for different tables, views, etc, ...
Now let's say you have used the layered approach. You would then simply find the class that does all updates and inserts to one specific table and simply do your changes there. The rest of the application perhaps doesn't even need to be aware of this change.
Performance is (in my opinion) not really a factor. Making an object isn't expensive at all, but is hardly measurably as it is. So I'd say go with the layered approach.

PostgreSQL database interaction in C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a project in which I have a PostgreSQL database containing various tables and what not. I have a c# application that needs to be able to enter new data/change existing data/ or retrieve data from the database.
My question is, is there some tool/framework that I should be using to make this interaction easier. Currently, we have written a bunch of database helper functions to make various common operations simple in C#, we've written classes that define what a Column and Table are. We have defined data model classes for all the tables in the database as well as defined table classes corresponding to each data model class.
Basically, we written a lot of code just to be able to interface with the database and I feel like there has to be a simpler way. But maybe not! That's why I'm asking.
I saw some people using the Entity Framework but I'm not familiar with it and don't know if it does what I'm looking for. Also, it seemed like it was geared towards MySql and the free PostgreSql tool for it were a bit hacky.
The short answer is: you are probably already doing it the best way with current technologies.
I have tried several ORM solutions and all of them failed to live up to expectations on one level or another. Entity Framework is starting to get mature, but as you already found, the PostgreSQL adapters are essentially hacks since EF is baked for Microsoft SQL at a low level. One of the better ones I have used is Telerik's ORM, but it costs $$$$ and is far from perfect (http://www.telerik.com/data-access).
One to look at is this: https://www.nuget.org/packages/Shaolinq.Postgres.DotConnect/ Note though that is is an early version, I have not used it myself and generally use at your own risk:)
There are some code first and Node.js specific tools out there that are starting to get interesting, but in the end, having some decent reusable data access library and object classes is generally still the best solution for general use.

Categories

Resources