ApplicationBasePage and Namespaces


Author
Message
PeterA
PeterA
StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Trent L. Taylor (10/19/2007)
I think that the problem is that it is in the App_Data folder. This is a unique folder and does not follow the same rules as the rest of the project. More than likely you will want to use the App_Code folder and create a shared class that can be resued or create a class library that has all of your shared logic and then reference that class library assembly. But I believe the App_Data folder is more intended for data files versus code files.




It is. And it would probably have helped if I'd have checked the folder. I actually have the ApplicationBasePage in the App_Code folder, not the App_Data folder. Sorry. But it sounds like the solution is the same -- I'd need a separate class library to accomplish what I need.



I'll just plan on that for the next release, since I'll be moving the code into compiled code libraries in App_Code and away from the code-behind files anyway.



Thanks!

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I think that the problem is that it is in the App_Data folder.  This is a unique folder and does not follow the same rules as the rest of the project.  More than likely you will want to use the App_Code folder and create a shared class that can be resued or create a class library that has all of your shared logic and then reference that class library assembly.  But I believe the App_Data folder is more intended for data files versus code files.
PeterA
PeterA
StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I had an interesting issue when I tried simplifying some code today and I'm not sure why this would happen.



I have my ApplicationBasePage that includes references to all my business objects. So far, so good. During the Page_Init event for each of my pages, I perform a few tasks related to the data layer (setting a Db2DataSourceItem attribute on the page) and initializing business object datasource keys (by calling a method in my Global.asax file called InitializeDataSourceKeys() that takes an ApplicationBasePage typed parameter).



I had a logic issue and needed to change the order (InitializeDataSourceKeys() needed to be called before I set my Db2DataSourceItem object). Thankfully, I only had 8 pages, but I thought it might be better to put the complete contents of the page event into a method in ApplicationBasePage so I wouldn't have to change it for every page in the future.



So I started moving it to a method in App_Data/ApplicationBasePage.cs called InitializeDataConnections(out ConnObj). Problem is, it wouldn't even compile the page.



I received an error that it couldn't locate the Db2 namespace in MicroFour.Strataframe.Data. It worked fine in my page, but not once I moved it to ApplicationBasePage.cs. I checked to make sure I had a reference to it for my Web Application Project -- and I did. I also checked to make sure I had a "using" statement at the top of ApplicationBasePage.cs -- and I did:



using MicroFour.Strataframe.Data;

using MicroFour.Strataframe.Data.Db2;




I kept getting the error. I ended up just moving everything back to the Page_Init event and it works fine. But I'm wondering why it wouldn't work with the code placed in ApplicationBasePage.



Any ideas? Do I need to do something different to reference DataSourceItem objects in ApplicationBasePage?



Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search