Brent
Brent

Reputation: 4876

Entity Framework for Sql Server Compact - setting .sdf file access permissions

I am trying to write a desktop app which uses Entity Framework for sql server compact (6.0). It is using click-once deployment.

ideally, all windows users would have full access to the database file, and for this reason it is set up in:

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\BlowTrial"

I am using the .net 4.0 framework, and was thinking of using the File.SetAccessControl method within the constructor for my DbConfiguration class. I have no experience with programatically setting file access permissions, and it seems like a potential minefield.

I was wondering if there might be better (or at least other) way to set access permissions to all users (and particularly if there are settings available which set the access permissions when entity framework for sql server compact creates the database file).

Thanks for your expertise.

Upvotes: 0

Views: 499

Answers (1)

ErikEJ
ErikEJ

Reputation: 41779

You cannot have a shared database with Click-once, in order to set the access control list you need admin rights (ie you need to run an installer). You can also set access rights via the xcacls command line tool. Keep in mind that the SQLCE database can only be shared between users on the same machine anyway.

Upvotes: 1

Related Questions