guid

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

久未见 提交于 2019-12-21 12:28:27
问题 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 user prefs etc. I was also considering using a link table with a guid and an int in it, but decided that as I don't think I actually need to have user id as a

REST - get a random number GET or POST?

痴心易碎 提交于 2019-12-21 09:16:12
问题 How should a random number generator properly be implemented in REST? GET RANDOM/ or.. POST RANDOM/ The server returns a different random number each time. I can see arguments for both ways. 回答1: I'd say this is the same as for a page returned that contains the current time - and many of these are done using GET. Abstractly, fetching a random number (or time) the server's state doesn't change - both time and random numbers can be described as an observation of an external event. E.g. http:/

how can I use GUID datatype in SQL Server 2008?

大兔子大兔子 提交于 2019-12-21 07:04:34
问题 I want to build an employees table using SQL SERVER 2008 , and in my table I want to have an ID for each employee . I heared about GUID and I kind of understood that its a data type , But I couldn't use it could you please show me the way to use it ... by the way , lets say I want something like this : CREATE TABLE Employees ( ID guid PRIMARY KEY, Name NVARCHAR(50) NOT NULL ) How can I do it ?? because I want to benefit from it , but I couldn't find out how to do that 回答1: It's not called

GUID: varchar(36) versus uniqueidentifier

房东的猫 提交于 2019-12-21 07:04:09
问题 I'm working with a legacy database that stores GUID values as a varchar(36) data type: CREATE TABLE T_Rows ( RowID VARCHAR(36) NOT NULL PRIMARY KEY, RowValue INT NOT NULL ) INSERT T_Rows (RowID, RowValue) VALUES (NEWID(), 1) I would assume that storing a GUID as a uniqueidentifier would be preferable since it's only 16 bytes in size as opposed to 36. Are there any advantages to storing a GUID as a varchar? 回答1: Perhaps only the fact that you can 'read' them from a SELECT statement (although I

WiX - Copy compiled web.config based on environment to website root

泄露秘密 提交于 2019-12-21 06:01:27
问题 As a part of my WiX installation, I am copying all the transformed/compiled web.config files to the install directory. The names of the compiled web.config are in format web.{ENV}.config. In my install UI I created a Custom Dialog where I parse the ENV and populate a combobox so that the user can select the environment to which we deploy to. This comboBox sets a Property ENV. I need to understand how i could use this property to copy the installed config files to the website root. Update:

Data localization in SQL Server with GUIDs or…?

北慕城南 提交于 2019-12-21 04:32:30
问题 I need to make a database that is highly localized. For almost all entities I need a translation to 5+ languages. Some entities even require and additional resource localized (like images which I enter as paths). The question now is: 1: LOOKUP TABLE PER ENTITY/TABLE (kinda bloated schema?) should I create a "Localized" localization lookup table for each table I need localized values (and use standard int/bigint PKs for elements) Like here: MYITEMS ------- - MyItemId BIGINT PK - MyItemPrice

Generating a unique *and* random URL in C#

南楼画角 提交于 2019-12-21 04:10:47
问题 My ultimate goal is to create a URL that is unique and cannot be guessed/predicted. The purpose of this URL is to allow users to perform operations like verifying their email address and resetting their password. These URLs would expire within a set amount of time (currently set to 24 hours). I was originally using a Guid for this purpose, but I now understand this to be somewhere between "just fine" and "very insecure", depending on which expert you listen to. So, I thought I'd beef up my

Create a Guid from an int

倖福魔咒の 提交于 2019-12-21 04:07:09
问题 Given an int , how can you create the same Guid repeatedly? Edit: I'm integrating two systems, one uses ints as a primary key, the other recognises an object by it's Guid. Because of this, I need to be able to recreate the same Guid for a given int so that the second system can recognise the entities coming from the first. 回答1: If you create a Guid based on an integer it will no longer be a globally unique identifier. Having said that you can use the constructor that takes an integer and some

How should I create my GUID?

一世执手 提交于 2019-12-21 03:38:25
问题 I'm going to be uploading images to a system and need them to be referenced by a non-sequential unique ID. I've read a little about GUIDs, and I'm wondering what the best approach to making one in PHP is. Should I md5() the current timestamp and salt it, or will PHP's uniqueid (http://www.php.net/manual/en/function.uniqid.php) function be sufficient enough? Thanks! 回答1: EDIT: Yikes! I forgot about this ancient answer of mine. To clarify confusion created by my naivety (consistent with the

Generate Guid on Serverside Entity Framework 5?

拜拜、爱过 提交于 2019-12-20 12:41:07
问题 I am coming from a nhibernate background and I am wondering how can I generate the Guid automatically on the serer side and not make a round trip to make it on the database side? In fluent nhibernate it is simple just Id(x => x.Id).GeneratedBy.GuidComb(); 回答1: If you want to generate the key on the server, simply do this in code: public class TestObject { public TestObject() { Id = Guid.NewGuid(); } public Guid Id { get; set; } } If you want the database to generate the key, then use the