Programmatically adding a propertytype to a membertype
I have searched around, but I can't seem to find an answer to this. What I am trying to do, is to create a package that will install 3 ascx files with forms and a dll. No problem here. One of these however, is fired when the package is installing, which is what I want as it needs to prepare the Umbraco installation by adding a membertype, membergroup and a property for the membertype.
When trying to create a property however, I need to add a DataTypeDefinition. I want to use an existing dataType, so I assume I can just hard code the GUID or ID with one of the get functions. But this seems sloppy. What would be the right way of doing this?
Yes, to my knowledge, using the GUID is the best way to retrieve the DataTypeDefinition (via GetDataTypeDefinition). The Id isn't reliable enough - as its specific to that Umbraco install, (unless you are using one of the default data-types that ships with Umbraco?)
Given that this is for an installable package - hardcoding the GUID is the only way to do it.
Programmatically adding a propertytype to a membertype
I have searched around, but I can't seem to find an answer to this. What I am trying to do, is to create a package that will install 3 ascx files with forms and a dll. No problem here. One of these however, is fired when the package is installing, which is what I want as it needs to prepare the Umbraco installation by adding a membertype, membergroup and a property for the membertype.
When trying to create a property however, I need to add a DataTypeDefinition. I want to use an existing dataType, so I assume I can just hard code the GUID or ID with one of the get functions. But this seems sloppy. What would be the right way of doing this?
Kind regards,
Ferdy
Hi Ferdy,
Yes, to my knowledge, using the GUID is the best way to retrieve the DataTypeDefinition (via GetDataTypeDefinition). The Id isn't reliable enough - as its specific to that Umbraco install, (unless you are using one of the default data-types that ships with Umbraco?)
Given that this is for an installable package - hardcoding the GUID is the only way to do it.
Cheers, Lee.
Thank you for the confirmation Lee. It is a default Umbraco datatype, so the ID will do just fine :)
Kind regards,
Ferdy
is working on a reply...