Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Application using EF 5 and SqlCe 4 - create, deploy and migrate

$
0
0

Hi,

I have to create a distributed WPF application with a flat database on client side in order to work offline if the WCF service is not reachable. 

I thought about using entity framework model first approach, mapped to a dummy sqlce-database file. Then I would customize the whole mapping thing the way that a user-related sqlce-database-file is created on client side executing a bunch of create-table commands for the first usage. Read and write would happen through Linq to Entity.  

Later, with every release,  I would ship a sql-file which updates the existing user-database. 

What I've got so far is the automatic generated .sqlce file when using "create database from model". I can modify this file, add it to the properties resouces of the assembly and execute the sql statements. I create a database file with user related filename, I can insert, update and delete using normal ado.net.

What I don't get is the mapping to the entity framework context to use linq to entity instead of sql statements.

I read about "SqlCeConnectionFactory" and the method SetInitializer() but I don't understand how to use it properly. Simply because I don't think that changing the automatically created context class that inherits from DbContext is the right way. 

Can anybody give me some hints, advices, code snippets, links etc... that could solve my problem? 

Maybe I am also totally wrong and there is a better way to get what I want?

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>