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.
Related
I am an ASP.Net Developer who uses Entity Framework Code First regularly. I literally began studying Xamarin Forms yesterday and my biggest question for any mobile platform has always centered around the easiest way to integrate with SQL Server. On initial research when I Googled using Xamarin Forms with SQL Server the consensus was binding through web services... which is fine but definitely a lot more work.
The thought occurred to me this morning about using EF with Xamarin Forms so I Googled it and apparently it is possible with EF Core. However before I go down that road I am hoping any of you could provide insights as to any significant performance differences with using EF Core to SQL Server remotely versus using Web API?
Obviously as far as app coding goes I would prefer EF Core but if there is a substantial difference in performance I would instead go the API route. Your experienced insights would be greatly appreciated and save a lot of time.
UPDATE:
Right after I posted this question I continued on in reading about EF Core within Xamarin Forms and apparently it uses SQLite. I had incorrectly assumed that since it was EF you could integrate with SQL Server. However after the two comments below it seems obvious that API is the way I should go even if it were possible. +1 for your comments and thank you for your help!
I know general, less specific questions aren't ideal. But I'm a beginner and are pretty confused about how I get started with databases for Windows 10 Universal Apps as well as WPF.
I'll try to make my main question more specific by asking the following.
What database is best for beginners/small projects to use in WPF, Console Apllication, and UWP projects? Or do I have to use different databases depending on the project?
How do I install, configure, and use said database (a small example or reference will suffice)?
Where does the EF (Entity Framework) fit into all this?
I tried installing EF for a UWP project, but things like using System.Data.Entity; couldn't be found. But there was no problem in a Console Application. How come?
Are there any good books, blogs, online courses etc. you can recommend to get up to speed on all this database stuff for .NET?
I have already started my education by taking this entity course on pluralsight, but it seems that learning about the Entity Framework doesn't necessarily teach me how to set up a database. At least not in this course.
I hope some of you more initiated people can help me out. As you can see, I'm running in circles (sure feels like that) and I hope you can push me in the right direction. A general brain dump on the subject would be more than a sufficient answer.
If I'm not making sense, or if this question just aren't good for SO, please let me know in the comments. I'll clarify and take action as needed.
What database is best for beginners/small projects to use in WPF, Console Apllication, and UWP projects? Or do I have to use different
databases depending on the project?
A MySQL database would be ideal, as this is a Windows project and would integrate best with any of those project types. However, for development, you can create a local database as an MDF file. This sort of database is particularly easy to set up and work with as it requires no additional database software or server.
How do I install said database?
Try following this walkthrough to setup a local database project in your solution. Once the database project is created, other projects in your solution can easily access it, as shown in this walkthrough. The second walkthrough applies to a Windows Forms application, but you could easily apply the same concepts to any other project type.
Where does the EF (Entity Framework) fit into all this?
Entity Framework provides functionality that makes it easier to interact with and automate actions related to a database, such as retrieving, deleting, or modifying database information. A more in-depth tutorial is provided here.
I tried installing EF for a UWP project, but things like using
System.Data.Entity; couldn't be found. But there was no problem in a
Console Application. How come?
This may be because your UWP project did not have a proper reference to the Entity Framework. You can add the Entity Framework to your project's references using NuGet or the Package Manager Console.
Are there any good books, blogs, online courses etc. you can recommend
to get up to speed on all this database stuff for .NET?
Microsoft has some good documentation for learning Entity Framework. This tutorial was the one I learned from.
I've just been on a course that talked about the advantages of using MVC 4 in C#.NET alongside using Entity framework to create object representations of a SQL database and using Unity to create instances of objects etc...
Problem is, It was very much an overview rather than a - step one.. create a project, step 2, download sql and set it up, create a database and do a dance. step 3, click here and type here to create an entity model of that db... etc etc.
Does anyone know any books out at the moment that make this entire subject easy to pick up... Once I know how to set up a SQL server and attach the entity framework (without using the buggy visual studio code generator that doesn't help me one bit), I might be able to make a flipping website ^_^...
P.S, I know PHP, JavaScript, Java, C++ very well... That means I know jack doodle about C# and C# libraries. This book would be a basic beginner tutorial thingy...
Any ideas?
Thanks in advance,
Pro ASP.NET MVC 4 (Professional Apress)
http://www.amazon.com/Pro-ASP-NET-MVC-Professional-Apress/dp/1430242361
this series is great.
Nice step-by-step process to creating an app
Great history of .NET development and the MVC frameworks
Best overview of the framework. Good coverage explaining just enough about controller, Views, EF, Helpers, Web API.
It's not a book but you might want to take a look at the MVC Music Store sample project. It uses MVC and Entity Framework. Not unity though, but they do have a rather lengthy PDF describing how the sample site was made.
We are having 5 years old mini ERP applications LAN based (Intranet only) with us, written in ASP.net 2.0
Now Since requirement changes a lot and Workflow also changed a lot, we decided to rewrite it again from scratch using WPF,WCF and our own custom Data Access Layer.
As it is LAN based our organisations is having Windows only Systems , so We can install the client module on each system.We are planning to develop both (Browser Based HTTP) and WPF based (Desktop) client Modules.
So , basically what i want to know from you people is that
Is it possible to create a solution with WPF project template(for UI),WCF Project template(for Middleware) and custom Data Access Library(AS DataAccessLayer)?
Later on if needed we will give browser based HTML+jQuery UI also so can we reuse the code mentioned in 1# ?
Our client wants Sybase as DB so is it possible to make DAL through Sybase DB?
Dont treat it discussion type Question and Dont close it
I simply wants to know the solution as 3 answers to these 3 questions due to these strange requirement with us :)
The answer is that it is definitely possible to do all of this.
Creating a front-end in WPF, a middle tier in WCF and a custom Data Access layer will work out well for you. Here is some guidance on how to connect WPF and WCF: http://wcfguidanceforwpf.codeplex.com/
You can definitely replace the WPF front-end with a HTML+jQuery UI. Here is some code on how to make use of a WCF service through jQuery: link
C# can access Sybase just fine. See This
Adam,
Yes it possible to all three question.
The are frameworks such as Prism / Caliburn / MMVM Light which can help with you UI.
If you base you business logic behind a WEB Api (SOAP / REST), you should be able to use similar business logic for both.
The database providers for Sybase, but may want to consider using an ORM (Object Relation Mapper) (Nhibernate / Entity Framework)
Cheers
Iain
The first two questions are well covered by the other answers. For the Sybase portion of the question here is what you should know:
Whether you plan to use a straight ADO.NET data layer or an ORM, the required DLLs and configuration set up are applicable to both. If you plan to use NHibernate 3.0 with Sybase then you should review the information here because it must use the NHibernate 2.1.2 provided dialect. NHibernate 2.1.2 does work just fine out of the box with Sybase ASE version 12. For that version, configure NHibernate with this dialect & driver:
NHibernate.Dialect.SybaseAdoNet12Dialect
NHibernate.Driver.SybaseAdoNet12ClientDriver
The SqlAnywhere drivers are different I believe but for ASE the DLLs you'll need to reference are listed below. You can only get them from Sybase through their support program to comply with their licensing.
Lastly, the Sybase ADO.NET driver seems to be a thin layer over their unmanaged DLL and its usage and stability shows it. It is certainly finickier to configure than the other ADO.NET drivers I've worked with. For example, since Sybase isn't typically configured to support a Unicode character set you need to set/map the .NET string parameters to use AnsiString or AnsiStringFixedLength (or AseDbType.VarChar) as appropriate. What's even more bizarre is if you forget to do this, the driver will silently fail and just write a null value to the table column.
sbgse2.dll
Sybase.AdoNet2.AseClient.dll
sybcsi_certicom_fips26.dll
sybcsi_core26.dll
sybcsi_profiler26.dll
sybdrvado20.dll
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