Click here to Skip to main content
15,886,919 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionCustomising Bootstrap NavBars Pin
xiecsuk5-May-15 0:37
xiecsuk5-May-15 0:37 
AnswerRe: Customising Bootstrap NavBars Pin
jkirkerx6-May-15 8:50
professionaljkirkerx6-May-15 8:50 
GeneralRe: Customising Bootstrap NavBars Pin
xiecsuk7-May-15 0:12
xiecsuk7-May-15 0:12 
GeneralRe: Customising Bootstrap NavBars Pin
jkirkerx7-May-15 7:26
professionaljkirkerx7-May-15 7:26 
QuestionCode Refactoring and Dependency Injection C# Pin
anshul02055-May-15 0:03
anshul02055-May-15 0:03 
AnswerRe: Code Refactoring and Dependency Injection C# Pin
F-ES Sitecore5-May-15 2:53
professionalF-ES Sitecore5-May-15 2:53 
QuestionRe: Code Refactoring and Dependency Injection C# Pin
anshul02055-May-15 6:02
anshul02055-May-15 6:02 
AnswerRe: Code Refactoring and Dependency Injection C# Pin
Marjan Venema8-May-15 8:11
professionalMarjan Venema8-May-15 8:11 
Assuming DataAccess is a static class, you are in for a bit of work. I can think of several approaches, all of them boiling down to some form of dependency injection without going as far as trying to shoehorn an IoC container into your existing code.

One approach that could work:

1. Create an IDataAccess interface. Give it all the methods your DataAccess class currently has to provide your business entities with their data.

2. Remove the static specifier from your DataAccess class and make it an implementer of the new IDataAccess interface.

3. Create a new static class, for example DataAccessLayer and give it a single method, for example: Current(). Implement that method to return an instance of the DataAccess class as an IDataAccess interface reference. It is up to you to create a new instance for every call or to create a single instance and return that all the time.

4. Give every business entity a property of type IDataAccess. (They do all derive from some base class I hope?) Name it DataAccess. As it is closer in scope than anything outside of your business entities any method in those entities referencing DataAccess should now use the interface property instead of the DataAccess class.

5. Implement the DataAccess property getter of your business entities in such a way that it can returns the DataAccessLayer.Current IDataAccess interface reference, UNLESS a private IDataAccess _DataAccess member is non-null. In that case return the member reference.

6. Give all your business entities an extra "InitalizeDataAccess" method taking an IDataAccess parameter. Implement it to assign whatever is passed in to the private _DataAccess member.

7. Use the InitializeDataAccess method in your tests to provide your business entities with an IDataAccess implementer (DataAccess fake) that provides the business entities with data as needed by your tests.
---
http://softwareonastring.com

QuestionJASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev4-May-15 9:12
HimenDev4-May-15 9:12 
General[REPOST] Pin
Sascha Lefèvre4-May-15 10:49
professionalSascha Lefèvre4-May-15 10:49 
GeneralIs there any solution...? Pin
HimenDev4-May-15 18:39
HimenDev4-May-15 18:39 
AnswerRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev5-May-15 4:00
professionalZurdoDev5-May-15 4:00 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev5-May-15 19:20
HimenDev5-May-15 19:20 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev6-May-15 1:51
professionalZurdoDev6-May-15 1:51 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev6-May-15 19:20
HimenDev6-May-15 19:20 
AnswerRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev7-May-15 2:00
professionalZurdoDev7-May-15 2:00 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev7-May-15 2:24
HimenDev7-May-15 2:24 
AnswerRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev7-May-15 2:34
professionalZurdoDev7-May-15 2:34 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev7-May-15 2:37
HimenDev7-May-15 2:37 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev7-May-15 2:49
professionalZurdoDev7-May-15 2:49 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev7-May-15 2:56
HimenDev7-May-15 2:56 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev7-May-15 2:57
professionalZurdoDev7-May-15 2:57 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev7-May-15 3:08
HimenDev7-May-15 3:08 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
ZurdoDev7-May-15 3:17
professionalZurdoDev7-May-15 3:17 
GeneralRe: JASON POST METHOD DOESNOT WORK WITH ASP.NET 2.0 FRAMEWORK BUT AFTER SETTING IT TO 3.5 IT WORKS.. Pin
HimenDev7-May-15 3:22
HimenDev7-May-15 3:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.