오류 : Null 값을 사용할 수없는 값 형식 인 System.Int32 형식의 멤버에 null 값을 할당 할 수 없습니다. 프로그램이 여기에서 충돌합니다 :LINQ : System.Int32가 nullable 값 형식이 아닙니다
Nullable<Int32> maxTagFrequency = (from t in tagSummary select t.tagCount).Max();
null이 허용되는 변수를 선언했기 때문에 이상한가요? maxTagFrequency은 ... 하나
전체 LINQ 쿼리를 작동하지 않습니다
private void BindTagCloud()
{
int pro_id = Convert.ToInt32(proj_id);
var tagSummary = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
tagCount = tagGroup.Count()
};
Nullable<Int32> maxTagFrequency = (from t in tagSummary select t.tagCount).Max();
var tagCloud = from af in db.AgileFactors
join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID
join s in db.Stories on psf.StoryID equals s.StoryID
join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID
join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID
join pro in db.Projects on it.ProjectID equals pro.ProjectID
where pro.ProjectID == pro_id &&
pro.ProjectID == it.ProjectID &&
it.ProjectIterationID == pim.ProjectIterationID &&
pim.ProjectIterationMemberID == s.ProjectIterationMemberID &&
s.StoryID == psf.StoryID &&
psf.AgileFactorID == af.AgileFactorID
group af by af.Name into tagGroup
select new
{
Tag = tagGroup.Key,
weight = (double)tagGroup.Count()/maxTagFrequency * 100
};
ListView1.DataSource = tagCloud;
ListView1.DataBind();
}
가능한 중복 [nullable sum 문제가있는 Linq 쿼리] (http://stackoverflow.com/questions/696431/linq-query-with-nullable-sum-problem) – RichardTheKiwi
여전히 문제를 해결할 수없는 것 같습니다. . – MiziaQ