using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Everest.Library.Data.Rule;
using Everest.Library.Data.Entity;
namespace Everest.CmsServices.Models{
partial class Cms_RssChannel : IRuleEntity
{
public Cms_RssChannel()
{
this.UUID = Guid.NewGuid();
}
#region IRuleEntity Members
public IEnumerable<RuleViolation> GetRuleViolations()
{
var dataContext = EverestCmsEntities.GetDataContext();
List<RuleViolation> list = new List<RuleViolation>();
this.aspnet_ApplicationsReference.Load(this.aspnet_Applications, this.EntityState);
var query = dataContext.Cms_RssChannel.Where(r => r.ChannelName == this.ChannelName && r.UUID != this.UUID && r.aspnet_Applications.ApplicationName == this.aspnet_Applications.ApplicationName);
if (query.Count() > 0)
{
list.Add(new RuleViolation("ChannelName", this.ChannelName, Resources.ItemAlreadyExists));
}
return list;
}
#endregion
}
}
|