Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breezenhcontrollerattribute fix+maxexpansiondepth added #35

Closed
wants to merge 9 commits into from
7 changes: 5 additions & 2 deletions Breeze.ContextProvider.NH/BreezeNHControllerAttribute.cs
Expand Up @@ -17,11 +17,14 @@ namespace Breeze.ContextProvider.NH
[AttributeUsage(AttributeTargets.Class)]
public class BreezeNHControllerAttribute : BreezeControllerAttribute
{
internal BreezeQueryableAttribute nhFilter = new BreezeNHQueryableAttribute();
public BreezeNHControllerAttribute()
{
this._queryableFilter = new BreezeNHQueryableAttribute();
}

protected override IFilterProvider GetQueryableFilterProvider(BreezeQueryableAttribute defaultFilter)
{
return new BreezeNHQueryableFilterProvider(nhFilter);
return new BreezeNHQueryableFilterProvider(defaultFilter);
}

}
Expand Down
13 changes: 12 additions & 1 deletion Breeze.WebApi2/BreezeControllerAttribute.cs
Expand Up @@ -23,6 +23,11 @@ namespace Breeze.WebApi2 {
[AttributeUsage(AttributeTargets.Class)]
public class BreezeControllerAttribute : Attribute, IControllerConfiguration {

public BreezeControllerAttribute()
{
this._queryableFilter = new BreezeQueryableAttribute() { AllowedQueryOptions = AllowedQueryOptions.All };
}

/// <summary>
/// Initialize the Breeze controller with a single <see cref="MediaTypeFormatter"/> for JSON
/// and a single <see cref="IFilterProvider"/> for Breeze OData support
Expand All @@ -47,6 +52,12 @@ public class BreezeControllerAttribute : Attribute, IControllerConfiguration {
}
}

public int MaxExpansionDepth
{
get { return _queryableFilter.MaxExpansionDepth; }
set { _queryableFilter.MaxExpansionDepth = value; }
}

/// <summary>
/// Gets or sets a value indicating whether query composition should
/// alter the original query when necessary to ensure a stable sort order.
Expand Down Expand Up @@ -173,7 +184,7 @@ public class BreezeControllerAttribute : Attribute, IControllerConfiguration {
return new EntityErrorsFilterProvider(entityErrorsFilter);
}

private BreezeQueryableAttribute _queryableFilter = new BreezeQueryableAttribute() { AllowedQueryOptions = AllowedQueryOptions.All };
protected BreezeQueryableAttribute _queryableFilter;
private MetadataToHttpResponseAttribute _metadataFilter = new MetadataToHttpResponseAttribute();
private EntityErrorsFilterAttribute _entityErrorsFilter = new EntityErrorsFilterAttribute();
private static object __lock = new object();
Expand Down