StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



ApplicationBasePage and NamespacesExpand / Collapse
Author
Message
Posted 10/18/2007 11:33:31 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 03/03/2008 1:40:52 PM
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!
Post #12061
Posted 10/19/2007 8:57:41 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 5:39:40 AM
Posts: 4,379, Visits: 4,422
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.
Post #12087
Posted 10/19/2007 10:04:59 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 03/03/2008 1:40:52 PM
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!
Post #12104
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:28am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.