score:1

var conntionRecord1Id = (from connectionBase in orgServiceContext
.CreateQuery("connection") 
where connectionBase["record1roleid"] == null 
select connectionBase.GetAttributeValue<Guid?>("record1id"))
.Distinct()
.ToList();   

More Query from same tag