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


12»»

Event HandlersExpand / Collapse
Author
Message
Posted 11/21/2005 5:32:31 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
I have inported a database into the deployment toolkit and used that as the data source for a project. I have created 2 bo's in the project and mapped them to 2 tables in the deployment kit. When building the project I get the following errors:
Error1The name 'boAllergies_CheckRulesOnCurrentRow' does not exist in the current contextE:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAllergies.Designer.cs

Error2The name 'boAllergies_SetDefaultValues' does not exist in the current contextE:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAllergies.Designer.cs

Error3The name 'boAdressFavorites_CheckRulesOnCurrentRow' does not exist in the current contextE:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAdressFavorites.Designer.cs

Error4The name 'boAdressFavorites_SetDefaultValues' does not exist in the current contextE:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAdressFavorites.Designer.cs

Am I supposed to create these handlers or are they supposed to be written by the framework?
Post #52
Posted 11/21/2005 6:58:31 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
Additional Info:

This is the problem. I changed the Project Name and Default Namespace in the Project Properties dialog of the BO Mapper. When I click "Rebuild All", The bo.designer.cs files get rebuilt with the new namespace BUT the bo.cs files get generated with the obsolete namespace.

I cannot tell where this info is being stored (nowhere obvious) but it is not being correctly updated when the namespace property is edited.
Post #59
Posted 11/21/2005 6:59:31 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 10:38:53 PM
Posts: 2,683, Visits: 1,883
You're using C#, and the Namespace defined within the configuration for each business object within the Business Object Mapper does not match the namespace of the business object's main code file. So, when the designer file is created, it's created in a different namespace...

We're working on removing the namespace requirement from the Business Object Mapper so that it will just use the namespace of the main code file, but in the mean time, you will have to configure your business objects with their proper namespace in the Business Object Mapper.


www.bungie.net
Post #60
Posted 11/21/2005 7:00:14 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
More additional info:

I got it backwards. the bo.cs is either generated correctly or not touched, the bo.designer.cs is generated incorrectly.
Post #63
Posted 11/21/2005 7:27:53 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
What I meant to say is that after changing the default namespace for the project and the default namespace in the BO mapper, the mapper is still generating namespaces that reference the name that I initially supplied to the mapper but subsequently altered.

It seems to have a memory for the phantom, obsolete name in preference to the name that now shows in the property form when generating code.
Post #66
Posted 11/21/2005 8:44:33 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
More...

The problem is that when the BO Mapper first processes a new BO it puts the current default namespace into each record in DTEPreferences in the StrataFrame database. If you subsequently edit the namespace property of the project, the edit does not propagate to DTEPreferences.
Post #67
Posted 11/21/2005 9:06:58 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
Since C# automatically uses a namespace when an object is created the Business Object Mapper project should be setup with a default namespace to help avoid this issue.  There are several ways to achieve this, the default namespace for the Business Object Mapper project or by overriding the namespace for each business object individually.

Let's assume the namespace of the project (and the business object's .cs file) is MyNameSpace.  To set the default namespace for all business objects when they are mapped, do the following:

1.) Open the Business Object Mapper
2.) Click on the project that needs to be modified
3.) On the configuration panel on the right, click Modify Project Properties
4.) Set the default namespace to match the namespace of the C# project.
5.) Rebuild the partial classes.

This will create the partial class with the namespace you just specified in the "default namespace" property.  To make sure the partial was generated properly open the business objects .designer.cs file and look for the namespace tag.  This will be set to the specified setting from above.  Open the business objects .cs file and make sure the same namespace is specified. 

Phantom Business Object

The phantom business object only appears within the Business Object Mapper when the namespace in the business object's .cs class does not match the namespace in the business object's .designer.cs.  This is usually due to an invalid namespace specified in the Business Object Mapper as mentioned earlier.

Bottom Line
The bottom line is that the namespace MUST match in both class files that comprise the business object.  Verify that the namespaces match and this will remove the "Phantom" business object.

Post #68
Posted 11/22/2005 12:21:47 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
This is a helpful summary.

The problem I am describing occurs after you do all of that.

IF you change your mind about the namespace and
a) edit the vs2005 default namespace AND
b) edit the project namespace in the BO Mapper AND
c) "rebuild all"
THEN
the changed namespace in the BO Mapper does NOT get pushed down into the definitions of the existing BO's in the database.

The result is that "rebuild all" regenerates xx.designer.cs files that each have the original namespace, not the current one. The projects then fail to compile because one part of the partial class (xx.cs) is in a different namespace from the other partial class (xx.designer.cs). The definitions of the event handlers and the code that uses them end up in different namespaces making the definitions invisible to the code that references the event handlers.
Post #70
Posted 11/22/2005 8:02:19 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
Daniel,

Change the namespace on the individual business object itself and the changes will take effect. The Default namespace for the BO Mapper project is used when a new business object is associated with a table. But we allow the developer to overwrite individual business objects namespace to allow business objects within the same project to exist in different namespaces. We might look at adding a "Change All" function that changes the individual business objects namespace when changing the default namespace. But as of right now, the BO Mapper works as designed. The reason we do not make a blanket change to all business objects when the default namespace is changed is to allow the developer to have control over the namespace of each individual business object and it could cause far more problems if we arbitrarily changed the individual items. However, we may add an option that allows the developer to "Change All" existing business objects since I can see how this could be helpful.
Post #71