This question is locked. New answers and comments are not allowed.
Hi,
I have a table with columns "ID", "uniqueID", etc etc ...
The generated class, is assuming the "uniqueID" columns has my primary key, causing errors when I'm trying to insert a new record.
I've tried to create a new partial class to use the MetadataType attribute and override the Column attribute, but still getting the same error, so I think is not considering this metadata when the INSERT query is being generated.
The new partial class have this code:
I appreciate any help for solving this issue.
Regards,
Tiago Salgado
I have a table with columns "ID", "uniqueID", etc etc ...
The generated class, is assuming the "uniqueID" columns has my primary key, causing errors when I'm trying to insert a new record.
private
int
_iD;
[Column(
"ID"
, OpenAccessType = OpenAccessType.Int32, Length = 0, Scale = 0, SqlType =
"int"
)]
[Storage(
"_iD"
)]
public
virtual
int
ID
{
get
{
return
this
._iD;
}
set
{
this
._iD = value;
}
}
private
Guid _uniqueID;
[Column(
"UniqueID"
, OpenAccessType = OpenAccessType.Guid, IsBackendCalculated =
true
, IsPrimaryKey =
true
, Length = 0, Scale = 0, SqlType =
"uniqueidentifier"
)]
[Storage(
"_uniqueID"
)]
public
virtual
Guid UniqueID
{
get
{
return
this
._uniqueID;
}
set
{
this
._uniqueID = value;
}
}
I've tried to create a new partial class to use the MetadataType attribute and override the Column attribute, but still getting the same error, so I think is not considering this metadata when the INSERT query is being generated.
The new partial class have this code:
[MetadataType(
typeof
(OrderFileMetadata))]
public
partial
class
OrderFile
{
internal
class
OrderFileMetadata
{
[Column(
"ID"
, OpenAccessType = OpenAccessType.Int32, Length = 0, Scale = 0, SqlType =
"int"
, IsBackendCalculated =
true
, IsPrimaryKey =
true
)]
public
int
ID {
get
;
set
; }
[Column(
"UniqueID"
, OpenAccessType = OpenAccessType.Guid, Length = 0, Scale = 0, SqlType =
"uniqueidentifier"
)]
public
Guid UniqueID {
get
;
set
; }
}
}
I appreciate any help for solving this issue.
Regards,
Tiago Salgado