Linq to Sql and SqlCE

imageIf you add a dbml to a project using the Visual Studio 2010 tools and then try to drag an object from a SqlCE database into the model it will fail with the message “source not supported”.
I don’t see any reasons it shouldn’t work…
imageChecking SqlMetal it has a description saying it supports SqlCE. Start the “Visual Studio Command Prompt”, change to the directory of the project and run
‘sqlmetal /dbml:Database1.dbml Database1.sdf’
image
Now, add the new file – Database1.dbml to your project (add existing item) and voilá, you can now edit the dbml model with the LocalDatabase elements.
To test, add any Linq query and run it.
image
Output:
Label ‘Label1’ is for Guid
‘633ca836-a300-4f16-8638-dfc104f21005’
Label ‘Label2’ is for Guid
‘2307a73e-aec2-4314-91b3-b1adea6784cf’
[Any key to quit]
Works for me! Smile
Advertisements

About skattefuten

Check my about page :-)
This entry was posted in .Net and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s