ALTER proc [dbo].[ReadReviewCountByHotelId]
@HotelId uniqueidentifier
AS
-- Returns the review count for given hotel.
BEGIN
SELECT Count(r.ReviewId) as ReviewCount
FROM Review r
WHERE r.Review_HotelId = @HotelId
END;
반환합니다. 내 프로젝트에 EF를 사용는 항상 0
public virtual ObjectResult<Nullable<int>> ReadReviewCountByHotelId(Nullable<System.Guid> hotelId)
{
var hotelIdParameter = hotelId.HasValue ?
new ObjectParameter("HotelId", hotelId) :
new ObjectParameter("HotelId", typeof(System.Guid));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<int>>("ReadReviewCountByHotelId", hotelIdParameter);
}
로
public static int ReadReviewCountByHotelId(Guid? hotelId)
{
int reviewCount = 0;
try
{
var tEntities = new TravelEntities();
Int32.TryParse(tEntities.ReadReviewCountByHotelId(hotelId).ToString(),out reviewCount);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return reviewCount;
}
EF 기능. 나는이 문제를 처음으로 본다.
감사합니다.
은 그래서 레코드가이 조건'r.Review_HotelId = @ HotelId' 제공하려고 존재하지 않는 것이 분명 다른'@ HotelId' 이미 존재하는 'Review_HotelId' 열 –