17
DATABASE WITH ENTITY FRAMEWORK CODEFIRST APPROACH WITH WCF SERVICE

How to create fast and much more efficient database

Embed Size (px)

DESCRIPTION

how to use code first model for creating and accessing database, with WCF service in just 5 minutes.

Citation preview

Page 1: How to create fast and much more efficient database

DATABASE WITH ENTITY FRAMEWORK CODEFIRST

APPROACH WITH WCF SERVICE

Page 2: How to create fast and much more efficient database

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

Page 3: How to create fast and much more efficient database

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.

Page 4: How to create fast and much more efficient database

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.

Page 5: How to create fast and much more efficient database
Page 6: How to create fast and much more efficient database

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

Page 7: How to create fast and much more efficient database

now writing code for above functionality ieinterface and defining various logic ….// as sample given for idea

Page 8: How to create fast and much more efficient database
Page 9: How to create fast and much more efficient database
Page 10: How to create fast and much more efficient database

DATABASE part all done just need to write a class for accessing service that will handle client call.

Page 11: How to create fast and much more efficient database
Page 12: How to create fast and much more efficient database
Page 13: How to create fast and much more efficient database

Entity model of classes built……visual way for checking if a proper Db is generated

Page 14: How to create fast and much more efficient database

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.

Page 15: How to create fast and much more efficient database
Page 16: How to create fast and much more efficient database
Page 17: How to create fast and much more efficient database

For any query and help in making different UI connection and config parts drop me a mail : [email protected]

THANK YOU