두 테이블을 조인하려고하면이 오류 메시지가 표시됩니다.linq 조인 오류
형식 인수는 쿼리에서 유추 할 수 없습니다.
및
는 코드입니다. 가오류 (12)는 조인 절에 표현 중 하나의 유형이 잘못되었습니다. 'Join'에 대한 호출에서 형식 유추가 실패했습니다.
var query = (from packagingMainCustom in this.Connection.Tbl_PackagingMaster_Main_Customs join packagingMainSync in this.Connection.Tbl_PackagingMaster_Main_Codes on new { packagingMainCustom.ID_Code, packagingMainCustom.ID_Version } equals new { packagingMainSync.ID_Code, packagingMainSync.ID_CurrentVersion } select packagingMainCustom);
이 LINQ 쿼리가 작동 :
var query = (from packagingMainCustom in this.Connection.Tbl_PackagingMaster_Main_Customs join packagingMainSync in this.Connection.Tbl_PackagingMaster_Main_Codes on new { packagingMainCustom.ID_Code } equals new { packagingMainSync.ID_Code } select packagingMainCustom);
따라서 오류 메시지가 packagingMainSync.ID_CurrentVersion 및 packagingMainCustom.ID_Version과 관련이있을 수 있습니다 여기에
//packagingMainCustom
private long _iD_Version;
[System.ComponentModel.DataAnnotations.Required()]
[System.ComponentModel.DataAnnotations.Key()]
public virtual long ID_Version
{
get
{
return this._iD_Version;
}
set
{
if(this._iD_Version != value)
{
this.OnPropertyChanging("ID_Version");
this._iD_Version = value;
this.OnPropertyChanged("ID_Version");
}
}
}
//packagingMainSync
private long _iD_CurrentVersion;
[System.ComponentModel.DataAnnotations.Required()]
public virtual long ID_CurrentVersion
{
get
{
return this._iD_CurrentVersion;
}
set
{
if(this._iD_CurrentVersion != value)
{
this.OnPropertyChanging("ID_CurrentVersion");
this._iD_CurrentVersion = value;
this.OnPropertyChanged("ID_CurrentVersion");
}
}
}
둘 사이의 유일한 차이점은 DataAnnotations.Key()
Annontations이다 : 여기
위의 쿼리가 작동하지 않는 이유는 무엇이며 오류 메시지는 무엇을 의미합니까?
의미가 있습니다. 그리고 당신은 좋은 설명을 해줬습니다. –