Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign Controller #3

Closed
stack72 opened this issue Oct 24, 2011 · 4 comments
Closed

Campaign Controller #3

stack72 opened this issue Oct 24, 2011 · 4 comments
Assignees

Comments

@stack72
Copy link
Contributor

stack72 commented Oct 24, 2011

Hey guys

there is a large dependency on the DataAccess layer throughout the campaign controller. This is caused by a new instance of the DataAccess layer being called in a lot of methods in this way:

Campaigns db = new Campaigns();
Campaign savedCampaign = db.Insert(campaign);
return savedCampaign.Id;

We really need to get this moved out of the Controller

I think this would be a big milestone for Separation of Concerns

Paul

@nbarnwell
Copy link
Member

Yes, our controllers need to go on a diet. We have IoC and a Services namespace for this, we just need to move the appropriate amount of that stuff out into those services. They're auto-wired so if you put "IMyFunkyNewService" as a ctor arg of a controller, it will automatically make sure that the MyFunkyNewService concrete instance is passed-in.

@kendallmiller
Copy link
Contributor

This is one of those points where there is a bit of complexity we need to manage.as we go about this. There are many databases (conceptually) - one for each charity. So we need to have it be super-easy and obvious when writing the modules how to get the current charity database and very hard to get the wrong one. This is so we can have multi-tennant application instances and be very confident we're never cross-connecting the data.

The central database needs to know all of the instances so it can redirect traffic to the right places (and provision/remove databases)

@Lethrir
Copy link
Contributor

Lethrir commented Oct 24, 2011

Hi Paul,

I have to confess that in the dying minutes I could get a hold of the 'I can change the proj file' pill / batton so I had to add a db ref into the QuickDonate view as I couldn't add a ViewModel file... Please don't shoot me but it might want fixing while you're at it...

Cheers,

Kim.

On 24 Oct 2011, at 15:41, Paul Stack wrote:

Hey guys

there is a large dependency on the DataAccess layer throughout the campaign controller. This is caused by a new instance of the DataAccess layer being called in a lot of methods in this way:

Campaigns db = new Campaigns();
Campaign savedCampaign = db.Insert(campaign);
return savedCampaign.Id;

We really need to get this moved out of the Controller

I think this would be a big milestone for Separation of Concerns

Paul

Reply to this email directly or view it on GitHub:
#3

@stack72
Copy link
Contributor Author

stack72 commented Oct 24, 2011

I agree Kendall - we need to be able to handle this correctly - I am working on separating the layers for now for cleanliness - that way we can work efficiently on the multi tennant aspect of the project :)

Kim dont worry - it needs to be shipped :)

Neil I have been working under that assumption all morning ;)

@stack72 stack72 closed this as completed Oct 24, 2011
@stack72 stack72 reopened this Oct 24, 2011
@ghost ghost assigned stack72 Oct 27, 2011
@stack72 stack72 closed this as completed Oct 30, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants