Menu

Error with asociation in 2 project different

2004-08-31
2004-09-01
  • Nobody/Anonymous

    I have a class Cliente in project ventas and FormaPago in project ERP. I have Association of Cliente and FormaPago. When I try recover a cliente, A mistake is produced: your code try recover Ventas.formapago and it is Incorrect, the correct is ERP.formapago. This error is produced in:

    Public Function CreateObjectInstance(ByVal baseObject As CPersistentObject) As CPersistentObject
        If AssemblyPath Is Nothing OrElse AssemblyPath = String.Empty Then
          Dim aa As [Assembly]
          aa = aa.GetAssembly(baseObject.GetType)
          'Just use the namespace property of the type instead of mucking around - danmayer 24May04
    **********here****************
    *****************************
          Return Activator.CreateInstance(aa.GetType(baseObject.GetType.Namespace & "." & Name))
    **********here****************
    *****************************
        Else
          Dim objHdl As ObjectHandle
          If ClassNameSpace = String.Empty Then
            objHdl = Activator.CreateInstanceFrom(AssemblyPath, Name)
          Else
            objHdl = Activator.CreateInstanceFrom(AssemblyPath, ClassNameSpace & "." & Name)
          End If
          Return CType(objHdl.Unwrap(), CPersistentObject)
        End If
      End Function

     
    • Richard Banks

      Richard Banks - 2004-08-31

      When objects are joined the assumption is made that the objects are in the same namespace, unless a specific namespace and assembly is provided.

      You need to provide more information in the XML mappings to help the framework use the correct assembly and namespace when instantiating a new object.

      In the <class ... /> mapping add the attributes

      assemblypath="..."
      namespace="..."

      as required to help find the class.  In you example, you would have
      <class name="FormaPago" AssemblyPath="..." Namespace="ERP" ... >
      ...
      </class>

      - Richard.

       
    • Nobody/Anonymous

      Its suggestion is the correct one
      Thank you.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.