RBS
asked on
MVC - Automatically Generate GUID for Id field
Hi:
A have an MVC application in which I have the following class:
I would like to make it so that:
Any help greatly  appreciated
RBS
A have an MVC application in which I have the following class:
public class Actor
{
public Actor(Guid id, string name)
{
Id = id;
Name = name;
}
public Guid Id { get; set; }
public string Name { get; set; }
}
I would like to make it so that:
1.
when I create an actor, the guid is generated automatically - as in an identity field2.
I can seed the database with 3 names -Any help greatly  appreciated
RBS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How are you connecting to the database? Entity Framework or Linq to SQL or other?
ASKER
Thanks - Guid.newguid() was the answer - sorry I didn't see this earlier.
RBS
RBS
ASKER