[CONNECT C#] How to handle XAttributes

I learned that external data can be linked on elements using linkages or XAttributes, and XAttributes are suggested over Linkages.

I found methods like AppendLinkage() for Element to handle linkages, but methods related to XAttributes in Addin development are barely mentioned.Can anybody teach me how to handle XAttributes in Addins.

By the way, I noticed this ScheduleWriteXAttribute() for  EditElementHandle struct in C++ documentation. Although I have no experience in C++ programming, I am still curious whether there are any similar types or functions with EditElementHandle or ScheduleWriteXAttribute() .

Thanks in advance.
Parents
  • Hi Frank,

    I guess these functionas are not documented officialy yet, but a plenty of *XAttribute* methods exist in DgnPlatformNET assembly already, so I guess it's just a matter of time. Maybe in comming Update 8 SDK?

    You should be aware that unique ID is required to use own XAttributes data, similarly to LinkageID (and other custom data oriented structures). This ID is available through BDN program.

    Often (but not always) better solution today (that does not require any ID) is to create EC schema and attach EC data to element(s). Internally it's based on XAttributes too,but API handles all logic how to distinguish between "normal XAttributes" and "EC data".

    With regards,

      Jan

  • Thanks a lot for the info, Jan

    I found examples about the EcSchema in the SDK, And it provided a great guide.

    "but a plenty of *XAttribute* methods exist in DgnPlatformNET assembly already,"

    I searched the keyword XAttribute in the  DgnPlatformNET assembly in visual studio Object browser, few were found and  none related to element. I also searched the keyword XAttri through all .cs files in the SDK examples, found nothing.

    MicroStation CE Update6 and SDK Updt7 are Installed and used in my system, so is it probably a problem of version difference that I can not find it?

    Best Regards,

    Frank 

  • Hi Frank,

    I found examples about the EcSchema in the SDK, And it provided a great guide.

    I recommend to search for this topic at MicroStation Programming forum too, there have been more discussions about EC data and related APIs.

    I searched the keyword XAttribute in the  DgnPlatformNET assembly in visual studio Object browser, few were found and  none related to element.

    I used Telerik JustDecompile to check what is inside Bentley.DgnPlatformNET assembly and I received over a hundred of results. But I did not whether they relate to Element or are part of an internal assembly code. The search was only a proof that XAttributes are somehow used in NET API today, so we can assume the support will be added to official NET API in future. I did not write anything about they can be used now.

    so is it probably a problem of version difference that I can not find it?

    I wrote my assumption is that XAttributes API is not described and available in current NET API. And because there is also not any example available now, I think XAttributes cannot be used now from NET API (of course it's possible to use C++/CLI to create a wrapper to native API, I did it in the past, but i requires extra knowledge and effort).

    With regards,

      Jan

Reply
  • Hi Frank,

    I found examples about the EcSchema in the SDK, And it provided a great guide.

    I recommend to search for this topic at MicroStation Programming forum too, there have been more discussions about EC data and related APIs.

    I searched the keyword XAttribute in the  DgnPlatformNET assembly in visual studio Object browser, few were found and  none related to element.

    I used Telerik JustDecompile to check what is inside Bentley.DgnPlatformNET assembly and I received over a hundred of results. But I did not whether they relate to Element or are part of an internal assembly code. The search was only a proof that XAttributes are somehow used in NET API today, so we can assume the support will be added to official NET API in future. I did not write anything about they can be used now.

    so is it probably a problem of version difference that I can not find it?

    I wrote my assumption is that XAttributes API is not described and available in current NET API. And because there is also not any example available now, I think XAttributes cannot be used now from NET API (of course it's possible to use C++/CLI to create a wrapper to native API, I did it in the past, but i requires extra knowledge and effort).

    With regards,

      Jan

Children
No Data