c# - How to make a GUID column in Orchard's migrations? -
i can make guid
column through arcgis , can make uniqueidentifier
column in sqlsqrver, orchard wants autogenerate table through migrations.cs
. unfortunately, guid
column make migration fail, no table created. tried decorate column in model [databasegenerated(databasegeneratedoption.computed)]
, didn't help. using wrong? or need different? make several other tables, prefer avoid bigger changes outside guid
column unless necessary.
migrations.cs (important parts):
public int create() { schemabuilder.createtable(typeof(foorecord).name, table => table .column<int>("id", column => column.primarykey().identity()) .column<guid>("guid", column => column.notnull().unique()) //other columns ); return 1; }
model:
public class foorecord { public virtual int id { get; set; } [databasegenerated(databasegeneratedoption.computed)] public virtual guid guid { get; set; } //other columns }
orchard didn't support syntax guids last checked (a few years ago) , had write this:
.column("myguid", dbtype.guid, column => column.notnull().unique())
Comments
Post a Comment