identity

Compact or renumber IDs for all tables, and reset sequences to max(id)?

走远了吗. 提交于 2019-12-20 10:54:48
问题 After running for a long time, I get more and more holes in the id field. Some tables' id are int32, and the id sequence is reaching its maximum value. Some of the Java sources are read-only, so I cannot simply change the id column type from int32 to long , which would break the API. I'd like to renumber them all. This may be not good practice, but good or bad is not concerned in this question. I want to renumber, especially, those very long IDs like "61789238", "548273826529524324". I don't

How should I handle user identity for a Window Phone / WCF / ASP.NET MVC application?

你。 提交于 2019-12-20 10:38:03
问题 I'm working on an application which allows data entry and display from both a Windows Phone application and an MVC 3 web interface. Data access for the phone client is via authenticated WCF services hosted in the MVC 3 application. Users will be tracking information which is unique to them, so the service will only show me data which I have entered. What is the simplest way to handle identity in this scenario? I'd thought of using Windows Live ID, since the phone application has access to a

Why is URN one of more popular formats used to uniquely identify the resource?

拥有回忆 提交于 2019-12-20 10:31:09
问题 I somewhat understand that URNs are used to provide unique and location independent name for the resource. Yet I fail to see their usefulness and how exactly they work: a) In order for URN to really be unique, there would have to be some central authority (similar to authority for domain names) where we could register URNs and that way ensure they are unique. Since there isn’t any such authority, how else do we make sure that our URNs are unique? And if we can’t. then what’s the point of

C# Class Auto increment ID

∥☆過路亽.° 提交于 2019-12-20 10:09:48
问题 I am creating a class in C# called "Robot", and each robot requires a unique ID property which gives themselves an identity. Is there any way of creating an auto incremental ID for each new class object? So, If i created 5 new robots, their IDs respectively will be 1, 2, 3, 4, 5. If I then destroy robot 2 and create a new robot later, it will have the ID of 2. And if I add a 6th it will have the ID of 6 and so on.. Thanks. 回答1: This will do the trick, and operate in a nice threadsafe way. Of

Get Identity Field out of KeyMembers

冷暖自知 提交于 2019-12-20 03:21:57
问题 I would like to get the KeyMembers where I have set in the Edmx the StoreGeneratedPattern to Identity is there a way to do this? I can get the KeyMembers with this code: private static IEnumerable<EdmMember> GetKeyMembers(string entityName) { var objectContext = EntityModel.ObjectContext; var metaData = objectContext .MetadataWorkspace .GetEntityContainer(objectContext.DefaultContainerName, DataSpace.CSpace) .BaseEntitySets .FirstOrDefault(x => x.ElementType.Name == entityName); return

How to change programmatically non-identity column to identity one?

我们两清 提交于 2019-12-20 02:08:06
问题 I have a table with column ID that is identity one. Next I create new non-identity column new_ID and update it with values from ID column + 1. Like this: new_ID = ID + 1 Next I drop ID column and rename new_ID to name 'ID'. And how to set Identity on this new column 'ID'? I would like to do this programmatically! 回答1: As far as I know, you have to create a temporary table with the ID field created as IDENTITY, then copy all the data from the original table. Finally, you drop the original

How to customize ASP.NET Identity Core Username to allow special characters and space

江枫思渺然 提交于 2019-12-19 18:58:34
问题 I have changed my Register Action Method to accept user Name instead of Email. if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Name, Email = model.Email, }; But when I Enter Name in TextBox like Joe Smith It give me an error that is Invalid UserName . It is not allowing user Name to Accept White space. My Question is how can I modify the builtin User Name to allow space and special characters. I am using ASP.NET Core. Thanks in Advance. 回答1: You can set user

How to customize ASP.NET Identity Core Username to allow special characters and space

偶尔善良 提交于 2019-12-19 18:58:07
问题 I have changed my Register Action Method to accept user Name instead of Email. if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Name, Email = model.Email, }; But when I Enter Name in TextBox like Joe Smith It give me an error that is Invalid UserName . It is not allowing user Name to Accept White space. My Question is how can I modify the builtin User Name to allow space and special characters. I am using ASP.NET Core. Thanks in Advance. 回答1: You can set user

Why does the 'is' operator say these methods aren't the same? [duplicate]

拈花ヽ惹草 提交于 2019-12-19 13:46:51
问题 This question already has answers here : Why is a method not identical to itself? (3 answers) Closed 7 months ago . Consider this code: class Person(object): def sayHello(self): return 'Hello' print(Person().sayHello is Person().sayHello) I would expect it to show True. Why does it show False? 回答1: Methods on are bound to instances at runtime . When you run the following code: print(Person().sayHello is Person().sayHello) you create two instances and each time you have a different memory

SQL Server and gaps in an Identity column

柔情痞子 提交于 2019-12-19 08:59:27
问题 I just noticed that if I have an identity column in a table, when I insert new rows SQL Server 2008 is automatically filling up the sequence if there are discontinuity. I mean, if in my identity column I have 1,2,5,6 if I insert other two rows in the table the system puts automatically 3 ,7 in the identity column. Do you know how to control this behavior? THANKS 回答1: That is the defined and documented SQL Server behavior, and there's really not much you can do about changing it. What did you