1

Closed

EntityGraphChangeSet.IsEmpty

description

The code looks incorrect:
 
namespace RiaServicesContrib.DomainServices.Client
{
public class EntityGraphChangeSet : IEnumerable<Entity>, IEnumerable
{
    public EntityGraphChangeSet()
    {
    }
    public ReadOnlyCollection<Entity> AddedEntities { get; internal set; }
    public bool IsEmpty
    {
        get
        {
            if( ModifiedEntities == null && RemovedEntities == null && AddedEntities == null)
                return true;
            return 
                ModifiedEntities.Count > 0 && RemovedEntities.Count > 0 && AddedEntities.Count > 0;
        }
    }
 
Shouldn't the code be ??:
            return 
                ModifiedEntities.Count == 0 && RemovedEntities.Count == 0 && AddedEntities.Count == 0;
Closed Dec 22, 2011 at 9:09 AM by MdeJ
Fixed in rev 66865.

comments

dw wrote Dec 20, 2011 at 6:53 PM

Correction - shouldn't the code be:

public bool IsEmpty
{
get
{
if ((ModifiedEntities != null && ModifiedEntities.Count > 0) || 
    (AddedEntities != null && AddedEntities.Count > 0) ||
    (RemovedEntities != null && RemovedEntities.Count > 0))
  return false;
return true;
}
}

MdeJ wrote Dec 22, 2011 at 9:06 AM

You are completely right. I've fixed the implementation and committed it to codeplex. Once nuget is working again I will also push a new nuget package.

Thanks for reporting!