BusinessObjectName property not populating


Author
Message
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K

Darn it … I had everything ready to roll … very familiar with web development with SF … BUT … after I converted to 4.5.2 (and I do not know if that is the problem or not) the SF control on the ASPX page does not enumerate with a list of Business Objects defined on the ApplicationBasePage.  So, I typed the information by hand (knowing it wouldn’t work) and received this message:

The given key was not presentin the directory with the stack trace pointing to the binding data to the web control in question, txtFirstName

The control is run of the mill SF textbox

<SFWeb:TextBox ID="txtFirstName" runat="server">

The application base page contains the appropriate business object definitions:

public ContactRegionsoContactRegions = new ContactRegions();

public SFSUsersBO oUsers = new SFSUsersBO();

public SFSPermissionsBOoPermissions = new SFSPermissionsBO();

public SFSRolesBO oRoles = new SFSRolesBO();

public SFSProjectsBOoSecurityProjects = new SFSProjectsBO();

public SFSPreferencesBOoPreferences = new SFSPreferencesBO();

public SFSRestrictionsBOoRestrictions = new SFSRestrictionsBO();

public SFSRestrictionItemsBOoRestrictionItems = new SFSRestrictionItemsBO();

public SFSUsersXRolesBOoUsersXRoles = new SFSUsersXRolesBO();

public SFSUsersXPermissionsBOoUsersXPermissions = new SFSUsersXPermissionsBO();

public PasswordResetoPasswordReset = new PasswordReset();

public SystemUsers oSystemUsers = new SystemUsers();

public EmailTemplatesoEmailTemplates = new EmailTemplates();

public EmailEngine oEmailEngine = new EmailEngine();

public CompanyConfigoCompanyConfig= new CompanyConfig();

public Lead oLead = new Lead();

public Addresses oAddresses = new Addresses();

As well as the proper ITypeResolver code referenced on the forum.

 I know I have to be missing something stupid but is was seven years ago or more since I created a rather intricate SF Web Form application.  I assume that all of the business objects defined in the ApplicationBasePage is the source of the BusinessObjectName property?

     #region [ ITypeResolver Implementation ]

 

    /// <summary>

    /// Must be used by the StrataFrame Application Framework to resolve a

    /// type within this ASP.NET project due to the fact that the Entry Assembly

    /// cannot be evaluated in an ASP.NET application.

    /// </summary>

    /// <param name="TypeName"></param>

    /// <returns></returns>

    /// <remarks></remarks>

    public System.Type ResolveType(string TypeName)

    {

        //-- Return the gettype for the given TypeName

        return System.Type.GetType(TypeName, false, true);

    }

 

    /// <summary>

    /// Required by the base class to allow the StrataFrame Application Framework

    /// to access the assemblies referenced by this project.

    /// </summary>

    /// <returns></returns>

    /// <remarks></remarks>

    public CompilationSection GetCompilationSection()

    {return (CompilationSection)WebConfigurationManager.GetSection("system.web/compilation");}

    #endregion



Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
Edited 9 Years Ago by Charles Thomas Blankenship
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
To begin troubleshooting I:

1. Created a new SF Web Application with an associated Business Object library
2. Added a business object
3. Added the new business object to the Application Base Page

... with the same result.

Next, I changed machines ... a development laptop where the application was also installed ... same results the business objects did not enumerate on the webform.

So, it is not a Video Studio problem ... the only thing I changed was an upgrade to 4.5.2.  

Has anyone else experienced a problem when migrating to this version?

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
StrataFrame Team
S
StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hrm, CT, we have all of our PracticeStudio and Patient Portal websites upgraded to 4.5.2.  I'm not aware of any issues enumerating the BOs on them.  Will you post the complete exception you're getting?  That stack trace will help.
StrataFrame Team
S
StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
FYI, I got the stack trace in your email from yesterday... it was caught up in the filter because of the colorful "engrish" subject line Whistling

I'm looking at it now.
Edited 9 Years Ago by Ben Chase
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
As I'm waiting for a response I've traced the code, as best I could, to the BasePage class in MicroFour StrataFrame UI project.  I modified the GetBusinessObject() and GetBusinessObjectNames() methods as such (added a function to write the name of the parameter to a text file:

The problem is that I cannot get to the code that runs the StrataFrame application itself (so, without MicroFour support) it is impossible for me to fix this.  However, I can access the framework code itself and did so using the following tests:

I created this function:
        
Public Function WritePropertyInfoToTextFile(ByVal Name As String) As String
       Dim file As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter("D:\Temporary\BusinessObjectNames", True)
       file.WriteLine(Name)
       file.Close()
       Return ""
End Function

And inserted it as such in the event Page_PreLoad() which calls the method InitializeBusinessObjects() like so:
        Private Sub InitializeBusinessObjects(ByVal PropertyInfos As PropertyInfo())
            '-- If the objects are already initialized, then don't go through this again
            If Me._BusinessObjectsInitialized Then Exit Sub
            Me._BusinessObjectsInitialized = True

            '-- Establish locals
            Dim loPropertyInfo As PropertyInfo
            Dim loBo As BusinessLayer
            Dim lcBoName As String

            '-- Cycle through the business objects' property infos and create new instances of them
            '   and save them to the session variables
            For Each loPropertyInfo In PropertyInfos
                '-- Get the name of the business object
                lcBoName = loPropertyInfo.Name

                '------------------------------------
                WritePropertyInfoToTextFile(lcBoName)
                '------------------------------------

                '-- Attempt to get the business object from the session variables
                loBo = CType(Session(lcBoName), BusinessLayer)

                '-- See if the item was found in the session variables
                If loBo Is Nothing Then
                    '-- The BO was not found, so we need to create a new one and save it off
                    loBo = CType(Activator.CreateInstance(loPropertyInfo.PropertyType), BusinessLayer)

                    '-- Save it in the session variable
                    Session.Add(lcBoName, loBo)
                End If

                '-- Put the business object in the dictionary
                If _BusinessObjects.ContainsKey(lcBoName) Then
                    _BusinessObjects(lcBoName) = loBo
                Else
                    _BusinessObjects.Add(lcBoName, loBo)
                End If

                '-- Save the instance to the property value
                loPropertyInfo.SetValue(Me, loBo, Nothing)
            Next
        End Sub
No file is created.  So, that's it ... I'm finished 



Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
StrataFrame Team
S
StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
CT, do you have your BOs wrapped with properties on the ApplicationBasePage?  The business object names are taken from the properties.  If you only have them as fields on the page, then the _BusinessObjects collection won't get initialized.
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)Advanced StrataFrame User (640 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
OH MY GAWD ... when I embarrass myself in public I pretty much go all out don't I!

Yes, this works much better.  I'm glad I qualified this post as "I'm missing something really obvious here"Blush
    
private Lead _LeadBO = new Lead();
public Lead LeadBO
{
    get { return _LeadBO; }
    set { _LeadBO = value; }
}
CT

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
StrataFrame Team
S
StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)StrataFrame Developer (6.3K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
This happens when you convert projects from VB.NET over to C#.  If you do a WithEvents field declaration in VB, it generates the member as a property, not a field, so it gets pretty confusing.

Don't sweat it CT Wink
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