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



ASP.NET C# questionsExpand / Collapse
Author
Message
Posted 10/22/2006 11:14:36 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 11/04/2006 8:44:01 PM
Posts: 6, Visits: 11
I like the concepts of this framework, but I'm having a few problems. First, I am declaring my business object in the applicationbasepage like this:

BusinessObject1 myBO = new BusinessObject1();

Whenever I go to a page in my app that inherits from ApplicationBasePage I cannot see the object I created above. Do I have a scoping issue or something?

Something else that is very frustrating is whenever I compile my business object it does not show up in my toolbox to allow me to drop it on a web form. Are we suppose to drop the business objects on Web Forms or do we reference it some other way?

A C# ASP.NET demo would certainly be helpful.

Any help is greatly appreciated.

Thanks,
Scott

 

Post #3767
Posted 10/22/2006 11:50:47 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 8:51:57 AM
Posts: 4,561, Visits: 4,544
Scott,

Youa re really close but there is one thing that you need to change.  In the ApplicationBasePage you do not create a new instance of the BO...just decalre it.  The framework will automatically create and manage the session for you.  Which ties into you second question...ASP.NET inherantly does not support the same type of component structure as you are used to in WinForms.   So the BOs will not be dropped on any of the pages, the business objects are just declared in an ApplicationBasepage and then any page than inherits that APplicationBasePage will have access to those declared business objects.

So in your ApplicationBasePage, you BO declarations will look somthing like this:

Notice that there is no "New" statement.  Just define the BOs and the framework will handle the rest.

Post #3776
Posted 10/22/2006 8:30:28 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 11/04/2006 8:44:01 PM
Posts: 6, Visits: 11
Trent,

Thanks for the response. Do you have a code snipet in C#. I've tried declaring the object as you suggested (in C#) and it still doesn't seem to work. Just want to be sure I understand.

Thanks,

Scott

Post #3781
Posted 10/23/2006 7:18:06 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 8:51:57 AM
Posts: 4,561, Visits: 4,544
Scott,

Are you defining your business objects in the same project as your web project?  If so, this could be a problem.  ASP.NET does not like to "play nice" with component classes defined within an ASP.NET project.  The best thing to do is create a Business Object Library and then place all of your business objects within that library.  Your ASP.NET app will then just reference the library and it will make things go much more smoothly.  If this doesn't work, I will be more than happy to get you a C# snippet.

Post #3783
Posted 10/23/2006 9:28:36 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 11/04/2006 8:44:01 PM
Posts: 6, Visits: 11
Trent,

I got it figured out. To answer your question, my Business Object library is a separate project from my application. I've got it referenced in my solution. In order to define my BO in the ApplicationBasePage I declare the following:

private BusinessObject1 _MyBO;

public BusinessObject1 MyBO

{

     get

       {

           return this._MyBO;

       }

    set

       {

           this._MyBO = value;

       }

}

This works well.

Thanks for your input.

Scott

Post #3790
Posted 10/23/2006 9:40:53 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 09/26/2008 8:30:36 AM
Posts: 2,685, Visits: 1,886
Yes, the TypeEditor for the binding looks for public properties that are of a type that is inherited from BusinessLayer... it just so happens that when you define a Public field in VB with the WithEvents keyword, .NET creates a property behind the scenes... so when we use reflection within the type editor, it doesn't see it as a field, but a property.

So, always define your business objects as properties within the ApplicaitonBasePage and you'll be good to go.


www.bungie.net
Post #3792
« 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 9:16am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 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.