GUID-question

Vote:
 

Hello,

What procedure are you using for GUID's when creating a new Content Type? When I see example of code that people have written there is often a GUID defined like this:

[ContentType(GUID = "abcdefg-1111-4f56-8a13-28ff2fc62960")]
public class SomePage : PageData

How is that GUID created? Are you entering the database and see what GUID that was generated for a particular class or how is the GUID chosen, in this case the "abcdefg-1111-4f56-8a13-28ff2fc62960"?

#70170
Apr 12, 2013 15:15
Vote:
 

If you are using Visual Studio 2010 - there is a GUID creation option.

Tools -> Create GUID -> Registry Format

and then trip off the surrounding { }

 

This is how i've always created my GUIDs for Page and Block types.  If this is a new page type or block type, if you supply the GUID in code, when the site builds and the page or block type is added, EPi will use the GUID you provided for that type.

#70172
Apr 12, 2013 15:41
Vote:
 

Thanks Mike!

#70173
Apr 12, 2013 15:42
Vote:
 

You can also use the Visual Studio integration. It creates the GUID for you when you're using the create new template command.

#70177
Apr 12, 2013 16:20
Vote:
 

Throwing in another option...

You could also set up a macro in Visual Studio to generate the GUID for you. Check out http://www.mikebevers.be/blog/2010/01/guid-generator-macro-for-visual-studio/.

#70178
Apr 12, 2013 17:44
Vote:
 

There is also some external websites where you can create GUIDs. My favorite is a site that can generate several at the same time. http://new-guid.com

#115755
Jan 18, 2015 20:27
Vote:
 

I guess the easiest thing to do, if you're using resharper, is to type nguid and press Tab.

#175135
Feb 13, 2017 18:02
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.