that are on the DynamicPublishedContent object. Added more unit tests for all of these classes. Moved some of the Dynamic objects into the web project which simplifies things quite a bit as some of these classes require access to the biz logic layer. Now we have intellisense for all of the nice magical methods that were on DynamicPublishedContent on our strongly typed object!
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Umbraco.Web.Models;
|
|
|
|
namespace Umbraco.Web.Dynamics
|
|
{
|
|
internal class DynamicPublishedContentIdEqualityComparer : EqualityComparer<DynamicPublishedContent>
|
|
{
|
|
|
|
public override bool Equals(DynamicPublishedContent x, DynamicPublishedContent y)
|
|
{
|
|
//Check whether the compared objects reference the same data.
|
|
if (Object.ReferenceEquals(x, y)) return true;
|
|
|
|
//Check whether any of the compared objects is null.
|
|
if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
|
|
return false;
|
|
|
|
//Check whether the nodes ids are equal.
|
|
return x.Id == y.Id;
|
|
|
|
}
|
|
|
|
public override int GetHashCode(DynamicPublishedContent obj)
|
|
{
|
|
if (Object.ReferenceEquals(obj, null)) return 0;
|
|
|
|
//Get hash code for the Name field if it is not null.
|
|
int hashId = obj.Id.GetHashCode();
|
|
|
|
return hashId;
|
|
}
|
|
|
|
}
|
|
}
|