Why AspNetUserId is stored as NVARCHAR? [closed] - asp.net-mvc

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
MVC5 identity stores userId in a string, but WHY?
If you don't feel like answering THE question you can just post random links how to store user id'z as int's...

Well, you seem to be quite rude for someone who is quite wrong.
ASP.NET Identity does NOT use strings for Id, it just uses strings for Id by default in the template generated by visual studio for a "starter project". You can use whatever you want for Id by defining a new IdentityUser type. Just like you aren't stuck with using the supplied templates for your views, or controllers, or anything else.
See https://stackoverflow.com/a/23573049/61164
The reason it uses strings is because the default identity type in the starter project template is a Guid, which not all database types support (remember, it supports more than just SQL Server). So, it uses strings to store them for compatibility reasons.

Well I guess it uses a different scheme for Id
If you will check your Database, a sample Id Looks like this
"62e41fbc-dbd6-41d2-8209-0fdf29fb1908"
Assuming this is hash or encrypted value.
If you want to store them as integer or make a Id Count, you can just add another entry to the table (ASPUserId) then make it an int then increment every time you make an entry

Related

Proper filenames in iOS project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I've been told during a job assignment review, that I used weird filenames in my iOS project.
I've added a picture of my project tree. Could you explain me what's weird about these names or if there are any flaws in the tree structure?
Thanks
"Weirdness" is a subjective term and it isn't one that I would use to give feedback to someone in a review.
There is nothing "weird" about the names you have chosen. Perhaps the interviewer was unable to immediately ascertain what "Launches.swift" contained?
Are you able to ask the reviewer for more information about what they perceived as weird? It would be nice to understand more about their opinion.
In general, the name of a source file best describes the primary
entity that it contains. A file that primarily contains a single type
has the name of that type. A file that extends an existing type with
protocol conformance is named with a combination of the type name and
the protocol name, joined with a plus (+) sign. For more complex
situations, exercise your best judgment.
source: https://google.github.io/swift/#file-names
For example:
MasterViewController -> LibraryMasterViewController
MasterPresenter -> BooksPresenter etc

Text id like youtube, is it encrypted or just a random string? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
A lot of website using these type of GET id, such as www.mywebste.com/?id=ABDXC5Z instead of www.mywebste.com/?id=30 I have a couple of questions regarding this:
What is the benefit of doing this? Is it for preventing auto-crawling that can get everything from the website?
How to implement it? Is the ID just a unique random string store in the database, or the encrypted data that can be decrypted to normal id?
If I store unique string index as ID, does that really affect the performance of my website?
There are a number of reasons that this might be used. Most likely, the system is auto-generating a random ID (from a hash or something similar) instead of a sequential one to prevent collisions or to allow simultaneous generation by multiple servers behind a load balancer. The ID isn't "encrypted", it's just an arbitrary key that the server uses to look up the resource in some sort of database.

What is the better way to format the data before display to the View [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
For example, I would like to change my ID to a custom code (12 -> A00012). Where should my function put in this conversion? In my previous coding, I did put in the View form, however, I think I should put in Model. How is the implementation in MVC ASP.NET?
In general, formatting should be in the view since things like appropriate currency/date formats are part of the user experience. Basically, you don't want to force an American date format on a European user and vice versa. Nor do you want to send a user's culture info down to your model. Usually things like padding should go at the user level as well.
In other cases, perhaps such as your special code, you may want to look into Attributes. For example, one place I used them was on a legacy data column that was a string that would either represent a date or some pre-defined statuses (like HOLD). By using an Attribute, I was able to essentially strongly type this column rather than allowing it to be a free-from string.

Ruby on Rails Generate Data But Don't Store It [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hi I am new to ruby and so far have only been making simple programs that store data using scaffold so not much programming although I do know ruby I am looking to make a password api but don't want to store the password in the database or have the user input it but I do want to display it to them, I know how to generate the password because I have done this before in c++, Can anyone point me in the right direction as to where I would put this function and how I would display it. Another note is that I am also asking the user for a number so I can generate a password of the desired length so this is just standard rails scaffold currently.
EDIT:
What I am looking to do is create a password for a user dynamically generated but I don't want the user to have to input anything apart from the size and I don't want to store the password in the database. It's kind of like a one shot deal so every time you generate a password it will be different and you won't be able to see past passwords. Hope this helps clear up what I meant.
Using your scaffold, your model does not have to be from ActiveRecord::Base. Just make a regular ruby object that handles the logic.
If you want to validate that the user inputted a value, there are active model methods available to you.
Try one of these railscasts:
http://railscasts.com/episodes/193-tableless-model
http://railscasts.com/episodes/219-active-model

I have heard that we can validate incoming data from a source using stored procedures. can so one explain this in a broader way? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to validate incoming data using stored procedures in real time? can some one explain this ?
You can, but I think this is a bad idea. Business logic does not belong in a database. It belongs in service code (middle tier of an application). The role of a database is to retrieve and save data, not validate it. At least not in the sense of applying business rules.
Now, you can do 'validation' in the database in the sense of check constraints and foreign key validation, but this would not be done in stored procedures. This is native support built into most modern database systems.
So, in my opinion, forget about doing data validation in a stored procedure. As I said, validation doesn't belong there, and, it's going to be much slower than putting that logic in a middle tier using C++, C# etc.

Resources