Style fixes

This commit is contained in:
Biarity 2019-11-17 08:51:13 +10:00
parent a582c6be06
commit 6652ada702
15 changed files with 26 additions and 30 deletions

View File

@ -1,9 +1,9 @@
using Sieve.Models;
using System;
using System;
using Sieve.Models;
namespace Sieve.Attributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class SieveAttribute : Attribute, ISievePropertyMetadata
{
/// <summary>

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace Sieve.Extensions
{

View File

@ -5,14 +5,14 @@ using System.Reflection;
namespace Sieve.Extensions
{
public static partial class LinqExtentions
public static partial class LinqExtentions
{
public static IQueryable<TEntity> OrderByDynamic<TEntity>(this IQueryable<TEntity> source, string fullPropertyName, PropertyInfo propertyInfo,
bool desc, bool useThenBy)
{
string command = desc ?
( useThenBy ? "ThenByDescending" : "OrderByDescending") :
( useThenBy ? "ThenBy" : "OrderBy");
(useThenBy ? "ThenByDescending" : "OrderByDescending") :
(useThenBy ? "ThenBy" : "OrderBy");
var type = typeof(TEntity);
var parameter = Expression.Parameter(type, "p");

View File

@ -1,6 +1,6 @@
namespace Sieve.Models
{
public enum FilterOperator
public enum FilterOperator
{
Equals,
NotEquals,

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
namespace Sieve.Models
{

View File

@ -1,6 +1,6 @@
namespace Sieve.Models
{
public interface ISievePropertyMetadata
public interface ISievePropertyMetadata
{
string Name { get; set; }
string FullName { get; }

View File

@ -1,6 +1,6 @@
namespace Sieve.Models
{
public interface ISortTerm
public interface ISortTerm
{
string Sort { set; }
bool Descending { get; }

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;

View File

@ -1,6 +1,6 @@
namespace Sieve.Models
{
public class SieveOptions
public class SieveOptions
{
public bool CaseSensitive { get; set; } = false;

View File

@ -1,6 +1,6 @@
namespace Sieve.Models
{
public class SievePropertyMetadata : ISievePropertyMetadata
public class SievePropertyMetadata : ISievePropertyMetadata
{
public string Name { get; set; }
public string FullName { get; set; }

View File

@ -1,6 +1,6 @@
namespace Sieve.Services
{
public interface ISieveCustomFilterMethods
public interface ISieveCustomFilterMethods
{
}
}

View File

@ -1,6 +1,6 @@
namespace Sieve.Services
{
public interface ISieveCustomSortMethods
public interface ISieveCustomSortMethods
{
}
}

View File

@ -356,7 +356,7 @@ namespace Sieve.Services
string name)
{
var property = mapper.FindProperty<TEntity>(canSortRequired, canFilterRequired, name, _options.Value.CaseSensitive);
if(property.Item1 == null)
if (property.Item1 == null)
{
var prop = FindPropertyBySieveAttribute<TEntity>(canSortRequired, canFilterRequired, name, _options.Value.CaseSensitive);
return (prop?.Name, prop);

View File

@ -1,20 +1,20 @@
using Sieve.Models;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Sieve.Models;
namespace Sieve.Services
{
public class SievePropertyMapper
public class SievePropertyMapper
{
private readonly Dictionary<Type, ICollection<KeyValuePair<PropertyInfo, ISievePropertyMetadata>>> _map
= new Dictionary<Type, ICollection<KeyValuePair<PropertyInfo, ISievePropertyMetadata>>>();
public PropertyFluentApi<TEntity> Property<TEntity>(Expression<Func<TEntity, object>> expression)
{
if(!_map.ContainsKey(typeof(TEntity)))
if (!_map.ContainsKey(typeof(TEntity)))
{
_map.Add(typeof(TEntity), new List<KeyValuePair<PropertyInfo, ISievePropertyMetadata>>());
}