The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Object reference not set to an instance of an object.

Last post 10-01-2007, 6:58 AM by rsiera. 2 replies.
Sort Posts: Previous Next
  •  09-29-2007, 6:08 PM 5386

    Crying [:'(] Object reference not set to an instance of an object.

    I can't get EntitySpaces to work.
    I get "Object reference not set to an instance of an object." at this line

        >If MyBase.SetSystemString(DnnXmodManagerPodiumkunstenVormingenMetadata.ColumnNames.Title, value) Then

    This is part of this codeblock

      ' <summary>
      ' Maps to dnn_XmodManager_Podiumkunsten_Vormingen.Title
      ' </summary>
      Public Overridable Property Title As System.String
       Get
        Return MyBase.GetSystemString(DnnXmodManagerPodiumkunstenVormingenMetadata.ColumnNames.Title)
       End Get
       
       Set(ByVal value As System.String)
        If MyBase.SetSystemString(DnnXmodManagerPodiumkunstenVormingenMetadata.ColumnNames.Title, value) Then
         Me.MarkFieldAsModified(DnnXmodManagerPodiumkunstenVormingenMetadata.ColumnNames.Title)
        End If
       End Set
      End Property   
       
    I disabled schema and metadata at generation time.
    I'm using v2007.0.0901
    I used the "Suggested EntitySpaces Dynamic Configuration for DotNetNuke"
    And when examining the the error code I see that the error occurs in  CreateSchema()  which is called by using AddNew() in SetSystemString() 

    Can anybody tell me what I might be doing wrong?

    Robrecht

  •  09-29-2007, 6:16 PM 5387 in reply to 5386

    Re: Object reference not set to an instance of an object.

    Please post the code for your method that sets your dynamic configuration and we will try to help.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  10-01-2007, 6:58 AM 5440 in reply to 5387

    Re: Object reference not set to an instance of an object.

    Well, I just used the default code as proposed by the gettingstarted.pdf  but changed it to vb

        Sub SetConnection()

            If (esConfigSettings.ConnectionInfo.Default <> "SiteSqlServer") Then
                Dim ConnectionInfoSettings As esConfigSettings = esConfigSettings.ConnectionInfo
                For Each connection As esConnectionElement In ConnectionInfoSettings.Connections
                    'if there is a SiteSqlServer in es connections set it default
                    If (connection.Name = "SiteSqlServer") Then
                        esConfigSettings.ConnectionInfo.Default = connection.Name
                        Return
                    End If

                Next

                'no SiteSqlServer found grab dnn cnn string and create
                Dim dnnConnection As String = ConfigurationManager.ConnectionStrings("SiteSqlServer").ConnectionString

                'Manually register a connection
                Dim conn As esConnectionElement = New esConnectionElement()
                conn.ConnectionString = dnnConnection
                conn.Name = "SiteSqlServer"
                conn.Provider = "EntitySpaces.SqlClientProvider"
                conn.ProviderClass = "DataProvider"
                conn.SqlAccessType = esSqlAccessType.DynamicSQL
                conn.ProviderMetadataKey = "esDefault"
                conn.DatabaseVersion = "2005"
                ' Assign the Default Connection
                esConfigSettings.ConnectionInfo.Connections.Add(conn)
                esConfigSettings.ConnectionInfo.Default = "SiteSqlServer"
                'Register the Loader
                esProviderFactory.Factory = New EntitySpaces.LoaderMT.esDataProviderFactory
            End If
        End Sub

    I checked in debug mode and all seems to work well. This code is called and works fine.

    But I think I know what is the problem.  I'm trying to create a new record in a way that is not documented (and just isn't possible apparently ;) )   I tried to declare a new Employees() object and change the properties and then save.

    I now trying it the documented way by creating an object through the collection. Probably that will work.

     

     

     

     

     

View as RSS news feed in XML