Event Handlers


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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:

Error   1   The name 'boAllergies_CheckRulesOnCurrentRow' does not exist in the current context   E:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAllergies.Designer.cs   



Error   2   The name 'boAllergies_SetDefaultValues' does not exist in the current context   E:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAllergies.Designer.cs   



Error   3   The name 'boAdressFavorites_CheckRulesOnCurrentRow' does not exist in the current context   E:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAdressFavorites.Designer.cs   



Error   4   The name 'boAdressFavorites_SetDefaultValues' does not exist in the current context   E:\_work.NET\MyBusinessObjectLibrary\MyBusinessObjectLibrary\boAdressFavorites.Designer.cs   



Am I supposed to create these handlers or are they supposed to be written by the framework?

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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.

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
A change has been made to the Business Object Mapper that gives you (the developer) three options when changing the default namespace of a Business Object Mapper project.  First, the new namespace can be updated on all business objects within the project.  Second, only business objects that have the same namespace as the old namespace can be updated.  And last, the individual business objects namespace can be left alone.

This will be available in the next update.

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