﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WebForms (How do I?)  » ApplicationBasePage and Namespaces</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 08 Apr 2026 22:16:19 GMT</lastBuildDate><ttl>20</ttl><item><title>ApplicationBasePage and Namespaces</title><link>http://forum.strataframe.net/FindPost12061.aspx</link><description>I had an interesting issue when I tried simplifying some code today and I'm not sure why this would happen.&lt;br&gt;
&lt;br&gt;
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).&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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:&lt;br&gt;
&lt;br&gt;
[quote]using MicroFour.Strataframe.Data;&lt;br&gt;
using MicroFour.Strataframe.Data.Db2;[/quote]&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
Any ideas? Do I need to do something different to reference DataSourceItem objects in ApplicationBasePage?&lt;br&gt;
&lt;br&gt;
Thanks!</description><pubDate>Fri, 19 Oct 2007 10:04:59 GMT</pubDate><dc:creator>PeterA</dc:creator></item><item><title>RE: ApplicationBasePage and Namespaces</title><link>http://forum.strataframe.net/FindPost12104.aspx</link><description>[quote][b]Trent L. Taylor (10/19/2007)[/b][hr]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.[/quote]&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;</description><pubDate>Fri, 19 Oct 2007 10:04:59 GMT</pubDate><dc:creator>PeterA</dc:creator></item><item><title>RE: ApplicationBasePage and Namespaces</title><link>http://forum.strataframe.net/FindPost12087.aspx</link><description>I think that the problem is that it is in the App_Data folder.&amp;nbsp; This is a unique folder and does not follow the same rules as the rest of the project.&amp;nbsp; 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.&amp;nbsp; But I believe the App_Data folder is more intended for data files versus code files.</description><pubDate>Fri, 19 Oct 2007 08:57:41 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>