Best practice/starter solution with EF 4 and POCO - c#

I have been trawling the internet for some months now, looking for some solid (and simple) examples regarding creating a new ASP.NET MVC3 (orMVC2) web site, that could connect to SQL Server 2008, using POCOs and EF4.
I understand the concepts, but seeing as their are many different ways to do the same job i'm struggling to find a full start to finish example I can use as a foundation, for a small web project I want to do in these technologies. I have the luxury of no existing db schema, but do not want to use code-first EF4 approach, I would rather do the model in SQL Server and then import entities into EF4.
I have created a project using 'the full stack' videos, but then realized that is specific to code-first, so sort of scratching my head again now.
If anyone has any good URL's to share, or indeed code/sln files then that would be great. Alternatively, if someone had the spare time to create such a project for a small fee, (50USD), from my specification then I would be interested in that also. I apologies if such requests are not permitted on this forum.
I look forward to hearing your comments.

This music store tutorial uses EF4. Although it's code-first, it shows how to connect to an existing DB as opposed to a lot of tutorials that create the DB "on the fly".

Here's a good example on how to "code first" with an existing database schema.
http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx

Related

Add / Remove columns on regular basis required in c# using Sql server, what should be the best approach?

In my application I'm allowing user to add/delete new fields to data base, so I need to find a best solution of my regular column add/update/delete problem in sql server database, I'm c#.net developer, and I usually work using Entity Framework. I have been googling this and came across EAV (Entity Attribute value) and then I found EAV Model Db Storage for .Net for c#.net.
Source code is provided and I went through it its good thing. but do we have a better solution of my problem, as I could not find any documentation on how to use it in any application(asp.net mvc, wpf, winforms, console app)
What if I do not want to combine traditional relational tables and entity-attribute-value(triplets) in same database?
I am new to EAV and not sure how should I handle this case.I will highly appreciate any response on it.
EDIT: I have found this: https://www.nrecosite.com/semantic_storage_net.aspx# but its not helping me out because there is no proper documentation. So I'm asking this particularly for c#.net development.
Thanks

WCF with Entity Framework multiple tables

I am creating a WCF service which is using Entity Framework for communication with SQL 2012 server. I have 3 questions.
1. Is is possible to create the database from VS2013 like in MVC5 models?
3. From where I can reach a good information except codeproject since there, they work only with one table and no relations at all.
I am a bit confused since I was get use to work with MVC and there everything is quite clear to me. Here I made simple exmplate, but I created the DB first and then the WCF + EF and the test Web Form application.
edited to not violate requirements
That's too broad a question to answer easily but "Pro C# 5.0 and the .NET 4.5 Framework" by Andrew Troelson has several chapters dedicated to the Entity Framework, WCF, and working with them. That would be your best bet for a high quality "tutorial" of sorts. It's my go-to reference text for C# and .NET and so far it has proven extremely useful during my programming internship.

Entity Framework, Stored Procedures and everything

So, I promised to see if I could help a friend with a small asp MVC application. I've started to regret it though since I haven't touched Entity Framework for many years.
We have a MSSQL database where users can post and list their own data (only). We don't want to have individual DB users, users logon using OAuth with external providers, which is working good.
Now we need to fix the CRUS and match the useridentity with his own posts. From our discussions there's three paths ahead.
Handling all the CRUD in webapp-code, a lot of examples and seem to work nice. My friend is kind of DB-centric though and an open database where someone suddenly could list all data using Crystal or Excel scares him.
Handling it in views, this is kind of a small webapp for now but I guess that could result in slow JOINS if there are a lot of posts in the end.
Handling all the CRUD with Stored Procedures, old style
I haven't used Entity Framework since it was brand new so I'm not aware of it's features today. Any advice or good resources on why to choose one over the other are welcome
Best Regards!

ORM, C# and MySQL - Take2

This questions actually refers to another one already asked, now I want to reformulate it :)
My issue is: There is an online shop running on MySQL database, hosted somewehre on the internet. Now I'd like to do some administration stuff from my C# application.
What I want to do: All I want is to run SQL-queries on that database and get the results as entities in my application so I can browse through them like through normal Lists/Classes and then post back the changes to the database. The problem is not the connection to the database - it works fine (using SSH and Connector/NET driver) - but the question, how to turn the SQL-results into C# classes.
I had a closer look at Fluent NHibernate and SubSonic, but I still can't figure out which one suits best or - even worse - if these are really the right approaches to my problem.
So I don't want to build an application which stores its own data in a database but gets the data it needs from a public database.
I hope I could make myself more clear this time :)
Thanks in advance!
ORM is definitely the way to, because it allows you to abstract your data access.
You may find a code generator helpful (to avoid the repetitive task of writing the classes and all their properties): NHibernate Code Generation.
This way you can still use classic NHibernae instead of Fluent Hibernate, which by the way looks pretty useful.

how to start using db in .NET platform

i want the most simple example from scratch how to
open new db
populate it with one table
connect and open it to simple select query
I have been looking for sothing relvant in the last 2 days please help me i neede just the basic
I am using visual studio 2008/2010 and i know mysql but dont know how to use VS for DB
I would prefer example using ADO.NET
There are tons of ways to do that.
Have a look at ADO.NET, LINQ2SQL, Entity Framework, NHibernate ....
You can find a lot of examples in internet.
If you want to stick with MySQL and C#, this PDF will walk you through the process.
http://dev.mysql.com/tech-resources/articles/Beginning_MYSQL_5_with_Visual_Studio.NET_2005.pdf
If you're just getting a start on things, check out the ASP.Net tutorial on building a Data Access Layer using TableAdapters. This is a great start because it gives you a nice drag and drop type interface for a lot of things, in addition to giving you strongly typed data. All the concepts of data adapters and connection strings are there, just managed by the object it creates.
The nice thing about the Table Adapters is that it leverages ADO.Net so you simply have to replace your DataAdapter with SQL, MySQL, SQLite adapter you need.
Once you get the hang of that, you can move into integrating your Business layer as well through the LINQ to SQL tutorials.
I've been in the same situation, just finding my feet with ADO and .Net database handling in Visual Studio. Up to now I'm finding that some of the most useful guides are:
Walkthrough of getting started with SQL Server Compact
Tutorial on Linq-to-SQL
The guide to using table adapters to synchronise the DataSet with the database
hi there my personal preference would be to use pgsql server and npgsql.dll. the link to
pgsql is here and just google npgsql.
these are the best documented fastest and easiest to use databases i have found (that is an opinion open to suggestions)

Categories

Resources