Upload
shivang-tyagi
View
260
Download
3
Tags:
Embed Size (px)
DESCRIPTION
how to use code first model for creating and accessing database, with WCF service in just 5 minutes.
Citation preview
DATABASE WITH ENTITY FRAMEWORK CODEFIRST
APPROACH WITH WCF SERVICE
We will be creating project in three parts..
• Creating database in code…(EF code first)• Defining context for DB• Writing services.
All code is done in VS 2013 and follow namespace properly…….and also add reference of NuGet packafe EF 6
For 1st two create new project with class library
For services use WCF service library
For creating database in this model we write normal coding classes as in programs, these classes with [data contract] attribute transfer into database table and [data member] attribute transfer into its attribute.
Now we define a context for accessing and interacting with databaseHere dbcontext is class defined in namespaces System.data.enitity as defined in slides for accessing databse.
Now we write the interfaces that will be accessible by clients ….ie functionality that can be visible on client sideTags placed over interfaces act as operation available for client to access. ie…as it is a WCF service
now writing code for above functionality ieinterface and defining various logic ….// as sample given for idea
DATABASE part all done just need to write a class for accessing service that will handle client call.
Entity model of classes built……visual way for checking if a proper Db is generated
Various DB table created after running code for first time in (localdb)\v11.0Table are created only if Db by that context is not there previously.
For any query and help in making different UI connection and config parts drop me a mail : [email protected]
THANK YOU