guid

C# Windows Form ComboBox Drop Down Contents.

I have a XML file with my data in it. I want to populate the drop down options in a combobox with 2 of the fields in that xml file - FirstName and LastName. In the xml document I am using GUID for the unique ID format, so the combobox dropdown would need the FirstName + LastName for each unique GUID variable. What I have so far is the ...

Please help in understanding how the pointer referencing works

I am currently reading "Developer's Workshop to COM and ATL 3.0". Chapter 3 introduces GUIDs, referencing and comparisons. Pointers are painful. I could use some help in deciphering the REFGUID #define (see below) and how memcmp in IsEqualGUID works against the pointers. Given: typedef struct_GUID{ unsigned long Data1; u...

Print a GUID variable

I have a GUID variable and I want to write inside a text file its value. GUID definition is: typedef struct _GUID { // size is 16 DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID; But I want to write its value like: CA04046D-0000-0000-0000-504944564944 I observed that: Data1 holds the dec...

Why does aspnet_users use guid for id rather than incrementing int? bonus points for help on extending user fields

Why does aspnet_users use guid for id rather than incrementing int? Also is there any reason no to use this in other tables as the primary key? It feels a bit odd as I know most apps I've worked with in the past just use the normal int system. I'm also about to start using this id to match against an extended details table for extra us...

Is using the built in asp.net authentication provider a bad idea due to guid being used as primary key etc

I'm at the stage in a project where I need to extend the user membership fields in a asp.net mvc website. I have gone through these different thought processes. Using "username" to join users to records. Very bad idea due to a user wanting to change their username etc. Then I thought I could connect the guid of userId to the other tab...

GUID.TryParse() ?

Obviously there is no public GUID.TryParse() in .NET CLR 2.0. So, I was looking into regular expressions [aka googling around to find one] and each time I found one there was a heated argument in the comments section about RegEx A doesn't work, use RegEx B. Then someone would write Regex C yadda yadda So anyway, What I decided to do w...

LinqDataSource - how do I select rows based on the current UserId?

Hello, I have a Grid View control that displays data based on what is returned by the LinqDataSource. The LinqDataSource selects data depending on the date chosen in a date control (used in the where clause), but I also need the where clause to be based on the current userID which is a GUID. How can I get the LinqDataSource to obtai...

How to convert a GUID to a string in C#?

I'm new to C#. I know in vb.net, i can do this: Dim guid as string = System.Guid.NewGuid.ToString In C#, I'm trying to do String guid = System.Guid.NewGuid().ToString; but i get an "Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method?" error. ...

Subsonic Linq guid problem

The construtor 'Void .ctor(System.Guid, Int32)' is not supported. this error occured with the following statements: var Test = from r in db.UserRoles join p in db.UserPermissions on new { r.userId, r.roleId} equals new { p.userId, p.roleId } select r; userId is a guid roleId is an integer ...

Simple proof that GUID is not unique

I'd like to prove that a GUID is not unique in a simple test program. I expected the following code to run for hours, but it's not working. How can I make it work? BigInteger begin = new BigInteger((long)0); BigInteger end = new BigInteger("340282366920938463463374607431768211456",10); //2^128 for(begin; begin<end; begin++) Console.W...

.NET: Blog post on GUID?

I once read a blog post by a dev at Microsoft about the anatomy--what individual pieces of data are combined--of a System.Guid. Does anyone have the link? I'm not finding it by googling. ...

Using uniqueidentifier as Primary Key and inserting it from the client application using parameterized queries.

I have created a database where I use uniqueidentifier as the primary key. I'm trying to run a parametrized query that in the end looks like this. (insert into someTable (uniqueID) Values('76c14693-5475-4224-ba94-7d30c919ac59') (uniqueID is my PK). This insert statement executes without issues when I run it in SQL Server Management Stu...

how to create GUID?

how to create GUID in asp.net 3.5? ...

Sequential Guid Generator C#

Is there any way to get the functionality of the Sql Server 2005+ Sequential Guid generator without inserting records to read it back on round trip or invoking a native win dll call? I saw someone answer with a way of using rpcrt4.dll but I'm not sure if that would be able to work from my hosted environment for production. Edit: Working...

Should a Sequential Guid primary key column be a clustered index?

The goal of using a sequential guid is so you can use clustered indexes without the high levels of fragmentation that would normally exist in a clustered index if it was a regular guid, correct? ...

Understanding GUIDS, updates, and patches with Windows-Installer

Hi, I'm learning about Windows-Installer and Wix, and have a number of questions related to how it works: If a component GUID changes, but the same files are in the component, what happens on a major upgrade? Do the files get replaced? If a component is removed from a product, what happens to the associated files on a major upgrade? ...

Problem getting GUID string value in Linq-To-Entity query

Hi, I am trying to write a GUID value to a string in a linq select. The code can be seen below (where c.ID is GUID), but I get the following error: Unable to cast the type 'System.Guid' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. var media = ( from media in Current...

Is there a way to distinguish a GUID from just a random number?

Being able to distinguish a GUID from random data can be useful when debugging obscure code defects. On Windows each GUID generated is of version 4 therefore it has '4' as the first half-byte of the third part. So if the 16-byte sequence violtates that rule it is not a version 4 GUID. For example, 567E1ECB-EA1C-42D3-A3ED-87A5D824D167 ...

Is a guid as identity field better in domain-driven design?

Is it easier to implement domain-driven design when using guids as identity fields instead of auto incrementing integers? With guids you don't have to jump to the database to get the actual value. ...

Using Parts of GUID as ID

I'm developing an ASP .Net MVC application. One of my actions requires id as a parameter. For example: public actionresult Detail(Guid id){ return View(); } As you can see, I'm using Guid instead of Int. The issue is more cosmetic. The url can be very long, such as localhost/Detail/0c157b42-379d-41d5-b9ba-83e9df9985b2. Is it safe...