Comments on: Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/ a mostly .NET but also some other cool techs blog Thu, 13 Aug 2020 18:46:56 +0000 hourly 1 https://wordpress.org/?v=5.7.11 By: Benjamin Schröter https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-1714 Tue, 27 Jan 2009 14:35:20 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-1714 Hi Atul
That scenario is in fact not supported at this time. I reproduced it and found a solution but I’m not sure how to build that solution into JaDAL. At the moment I will not do that, but I can tell you a way to use your own Classes with DynamicProperties.

First of all you have to implement a TypeConverter for your TestClass and use the TypeConverter-Attribute on the TestClass as well (please use the string overload instead of the typeof() version of that attribute). When persisting the TestClass, the TypeConverter will be used to create a string representation of its value. To create a new TestClass from that representation when loading it is used too. For an example take a look at the DynamicProperty-CollectionTypeConverter.cs file from the JaDAL source code.

Now the values will be stored in the file when saving the DSL model but there is still a problem when loading the file: the class TestClass is not known by the DynamicProperty system and cannot be created. One solution is, to add your TestClass to the JaDAL assembly (or take the DynamicProperty code into your DSL assembly).

Another solution is to change the code saving the TestClass to use the AssemblyQualifiedName instead of the namespace + class name. Now the TestClass can be created but if you change the version or public key of your assembly, old files cannot longer be loaded (since the public key and the version are part of the AssemblyQualifiedName). If you prefer that solution, you have to change the source code of JaDAL a little bit: In the DynamicPropertyCollectionTypeConverter class there is a line
> attr = new XAttribute(“type_” + i, property.Type.ToString());
change it to
> attr = new XAttribute(“type_” + i, property.Type.AssemblyQualifiedName);
Maybe you should add an if statement to use the first way for classes from mscorelib and from the JaDAL assembly and use the second way only for your own classes.

If you have some more questions, do not hesitate to write me an email or a comment on the blog.

]]>
By: Atul Katare https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-1654 Mon, 19 Jan 2009 09:54:30 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-1654 Hi
Good Article on Dynamic Property

I have some query about how to provide external Type as Type in AddProperty() method

DynamicPropertyCollection dpc=new DynamicPropertyCollection ();

dpc.Addproperty(“test”,typeof(TestClass), new TestClass())

when I close visual studio and open next time It never persist its value
but It work with string,Int,bool, Datetime object
Is there any solution for this scenario.

Thank You

]]>
By: Ticklish Techs » Blog Archive » Workaround for Known Issue with TypeDescriptors in DSL Tools for Visual Studio https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-596 Sat, 19 Jul 2008 17:33:57 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-596 […] time ago I posted a workaround for this problem with the TypeConverter, but today a realized that this workaround does not work […]

]]>
By: Má»™t số bài há»?c vá»? DSL sÆ°u tầm(luôn cập nhật) « IT Technology https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-458 Mon, 12 May 2008 04:50:50 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-458 […] 1. Workaround for Known Issue with TypeConverters in DSL Tools for Visual Studio […]

]]>
By: Francesio https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-415 Mon, 24 Mar 2008 14:14:07 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-415 Great page.., man

]]>
By: Ticklish Techs » Blog Archive » Adding properties to Domain Classes at runtime with DSL Tools https://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/comment-page-1/#comment-373 Sun, 17 Feb 2008 13:21:12 +0000 http://www.ticklishtechs.net/2008/02/06/workaround-for-known-issue-with-typeconverters-in-dsl-tools-for-visual-studio/#comment-373 […] is a known issue and a workaround I described here with the TypeConverterAttribute and the DSL […]

]]>