implemented ISearchable on Quote
This commit is contained in:
parent
1e73d17925
commit
0170c85a03
@ -6,7 +6,7 @@
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
|
||||
<property name="Text" column="quote_text" not-null="true" type="string" length="1024"/>
|
||||
<property name="text" access="field" column="quote_text" not-null="true" type="string" length="1024"/>
|
||||
<property name="Created" column="created" not-null="true" type="DateTime" />
|
||||
<property name="Modified" column="modified" not-null="false" type="DateTime" />
|
||||
<many-to-one name="Creator" column="creator" not-null="true" foreign-key="fk_quote_user"/>
|
||||
|
@ -4,9 +4,11 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Iesi.Collections.Generic;
|
||||
using Portoa.Persistence;
|
||||
using Portoa.Search;
|
||||
|
||||
namespace VideoGameQuotes.Api {
|
||||
public class Quote : Entity<Quote, int>, IDtoMappable<QuoteDto> {
|
||||
public class Quote : Entity<Quote, int>, IDtoMappable<QuoteDto>, ISearchable {
|
||||
private string text;
|
||||
private readonly Iesi.Collections.Generic.ISet<Vote> votes = new HashedSet<Vote>();
|
||||
private readonly Iesi.Collections.Generic.ISet<QuoteFlag> flags = new HashedSet<QuoteFlag>();
|
||||
private readonly Iesi.Collections.Generic.ISet<Category> categories = new HashedSet<Category>();
|
||||
@ -19,9 +21,18 @@ namespace VideoGameQuotes.Api {
|
||||
public virtual DateTime Created { get; set; }
|
||||
public virtual DateTime? Modified { get; set; }
|
||||
|
||||
public virtual string Text { get; set; }
|
||||
public virtual Game Game { get; set; }
|
||||
public virtual string Text {
|
||||
get { return text; }
|
||||
set {
|
||||
if (value != text) {
|
||||
ShouldIndex = true;
|
||||
}
|
||||
|
||||
text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Game Game { get; set; }
|
||||
public virtual IEnumerable<Vote> Votes { get { return votes; } }
|
||||
public virtual IEnumerable<QuoteFlag> Flags { get { return flags; } }
|
||||
public virtual IEnumerable<Category> Categories { get { return categories; } }
|
||||
@ -123,6 +134,8 @@ namespace VideoGameQuotes.Api {
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual bool ShouldIndex { get; private set; }
|
||||
}
|
||||
|
||||
public class QuoteDto {
|
||||
|
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using Microsoft.Practices.Unity;
|
||||
using Microsoft.Practices.Unity.InterceptionExtension;
|
||||
@ -47,7 +45,7 @@ namespace VideoGameQuotes.Web.Configuration {
|
||||
}
|
||||
|
||||
var quote = returnValue.ReturnValue as Quote;
|
||||
if (quote == null) {
|
||||
if (quote == null || !quote.ShouldIndex) {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user