Print Page | Close Window

Migrating from n-tier to standalone app

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3357
Printed Date: 25-Apr-2024 at 7:07am


Topic: Migrating from n-tier to standalone app
Posted By: pponzano
Subject: Migrating from n-tier to standalone app
Date 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
 



Replies:
Posted By: Siyfion
Date 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;


Posted By: pponzano
Date 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
 


Posted By: Siyfion
Date 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! :)



Print Page | Close Window