Reputation: 11
I am currently working on a Website which uses 3 Projects, a web Project, a definitions project and a data project. Because I want to publish the Website in different languages I am using session variables to set the language. Now I have to translate something from the data project and I don't know how to set a session variable in it. It already worked in the web project with HttpContext.Current.Session but to use this method you have to use a Controller. Becouse I don't want to have controllers in the data Project I wanted to ask if there is another way to use Session variables for this Project... I hope you can help me Thank you in advance
Upvotes: 0
Views: 84
Reputation: 39
If I've got your problem correctly, you have some troubles with layers/abstractions/architecture... Is the Data project something like Data Access Layer? Is it being used for accessing Data storage (Database)? If yes, it shouldn't know anything regarding UI stuff (session variable, HttpContext, e.t.c.).
So, ideally, the Controller should retrieve language from the Session object and pass to the Data layer as a parameter. Depends on that parameter, Data project should make a decision.
May be I was wrong regarding Data project definition...
Upvotes: 1