New Posts New Posts RSS Feed: Migrating from n-tier to standalone app
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Migrating from n-tier to standalone app

 Post Reply Post Reply
Author
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Topic: Migrating from n-tier to standalone app
    Posted: 24-Mar-2012 at 5:35am
Hello,
I've got a wcf application based on ideablade n-tier application and cocktail, I've been asked to mantain 2 version of the software, one that's for the major of user that's n-tier and a version that direcly communicates with the database (so EDMX file inside the module), i was wondering how to do it at best without having to rewrite all the code, should I create modules that have the edmx file linked as file? (Add as link feature) (and adding the repository files to the project as well?)
 
Thanks
 
Back to Top
Siyfion View Drop Down
Groupie
Groupie
Avatar

Joined: 22-Mar-2012
Location: Bristol, UK
Posts: 47
Post Options Post Options   Quote Siyfion Quote  Post ReplyReply Direct Link To This Post Posted: 28-Mar-2012 at 3:13am
You could:

- Separate the model into it's own assembly and reference it from the main project and the n-tier projects.
- Then put a duplicate connection string in the main project's App.config file
- Make the connection configurable in any way you like, ie. via config settings (bad coding, but you get the example!)

var dataSource = ConfigurationManager.AppSettings["SqlSource"];
var useWebService = Boolean.Parse(ConfigurationManager.AppSettings["UseWebService"]);
var entityServiceOption = useWebService
? EntityServiceOption.UseDistributedService
: EntityServiceOption.UseLocalService;

var serviceHost = ConfigurationManager.AppSettings["ServiceHost"];

var connectionOptions = new ConnectionOptions(
name: "TestConnection",
shouldConnect: true,
dataSourceExtension: dataSource,
serviceKey: serviceHost,
entityServiceOption: entityServiceOption);
            
return connectionOptions;
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 28-Mar-2012 at 3:27am
Hello Siyfion,
I've adopted a quite similar structure while waiting for an answer...for now I've a .DA assembly that contains the edmx and the Client parts (repository, proxy) are as shared link for the models/view since it's still under discussion forn ow I've cloned them
Thanks
 
Back to Top
Siyfion View Drop Down
Groupie
Groupie
Avatar

Joined: 22-Mar-2012
Location: Bristol, UK
Posts: 47
Post Options Post Options   Quote Siyfion Quote  Post ReplyReply Direct Link To This Post Posted: 28-Mar-2012 at 3:29am
Obviously doing it the way I suggested means that the connection string would still be in the app.config even when running n-tier, this could be a security vulnerability! :)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down