removed redundant qualifiers.

pull/4/head
kay.one 11 years ago
parent 50f66cbcca
commit e89a35522e

@ -14,10 +14,12 @@ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
using System;
using System.Globalization;
using Marr.Data.Mapping;
namespace Marr.Data.Converters
{
public class CastConverter<TClr, TDb> : Marr.Data.Converters.IConverter
public class CastConverter<TClr, TDb> : IConverter
where TClr : IConvertible
where TDb : IConvertible
{
@ -28,16 +30,16 @@ namespace Marr.Data.Converters
get { return typeof(TDb); }
}
public object FromDB(Marr.Data.Mapping.ColumnMap map, object dbValue)
public object FromDB(ColumnMap map, object dbValue)
{
TDb val = (TDb)dbValue;
return val.ToType(typeof(TClr), System.Globalization.CultureInfo.InvariantCulture);
return val.ToType(typeof(TClr), CultureInfo.InvariantCulture);
}
public object ToDB(object clrValue)
{
TClr val = (TClr)clrValue;
return val.ToType(typeof(TDb), System.Globalization.CultureInfo.InvariantCulture);
return val.ToType(typeof(TDb), CultureInfo.InvariantCulture);
}
#endregion

@ -131,7 +131,7 @@ namespace Marr.Data
if (parameter.Value == null)
parameter.Value = DBNull.Value;
this.Parameters.Add(parameter);
Parameters.Add(parameter);
return parameter;
}
@ -395,7 +395,7 @@ namespace Marr.Data
public int InsertDataTable(DataTable table, string insertSP)
{
return this.InsertDataTable(table, insertSP, UpdateRowSource.None);
return InsertDataTable(table, insertSP, UpdateRowSource.None);
}
public int InsertDataTable(DataTable dt, string sql, UpdateRowSource updateRowSource)
@ -462,7 +462,7 @@ namespace Marr.Data
public T Find<T>(string sql)
{
return this.Find<T>(sql, default(T));
return Find<T>(sql, default(T));
}
/// <summary>
@ -526,7 +526,7 @@ namespace Marr.Data
/// <returns>Returns a QueryBuilder of T.</returns>
public QueryBuilder<T> Query<T>()
{
var dialect = QGen.QueryFactory.CreateDialect(this);
var dialect = QueryFactory.CreateDialect(this);
return new QueryBuilder<T>(this, dialect);
}
@ -783,7 +783,7 @@ namespace Marr.Data
public int Delete<T>(string tableName, Expression<Func<T, bool>> filter)
{
// Remember sql mode
var previousSqlMode = this.SqlMode;
var previousSqlMode = SqlMode;
SqlMode = SqlModes.Text;
var mappingHelper = new MappingHelper(this);
@ -791,7 +791,7 @@ namespace Marr.Data
{
tableName = MapRepository.Instance.GetTableName(typeof(T));
}
var dialect = QGen.QueryFactory.CreateDialect(this);
var dialect = QueryFactory.CreateDialect(this);
TableCollection tables = new TableCollection();
tables.Add(new Table(typeof(T)));
var where = new WhereBuilder<T>(Command, dialect, filter, tables, false, false);

@ -84,7 +84,7 @@ namespace Marr.Data
}
// Create a new EntityGraph for each child relationship that is not lazy loaded
foreach (Relationship childRelationship in this.Relationships)
foreach (Relationship childRelationship in Relationships)
{
if (!childRelationship.IsLazyLoaded)
{
@ -169,7 +169,7 @@ namespace Marr.Data
_entity = entityInstance;
// Add newly created entityInstance to list (Many) or set it to field (One)
if (this.IsRoot)
if (IsRoot)
{
RootList.Add(entityInstance);
}
@ -213,7 +213,7 @@ namespace Marr.Data
bool isNewGroup = false;
// Get primary keys from parent entity and any one-to-one child entites
GroupingKeyCollection groupingKeyColumns = this.GroupingKeyColumns;
GroupingKeyCollection groupingKeyColumns = GroupingKeyColumns;
// Concatenate column values
KeyGroupInfo keyGroupInfo = groupingKeyColumns.CreateGroupingKey(reader);
@ -265,7 +265,7 @@ namespace Marr.Data
private object FindParentReference()
{
var parent = this.Parent.Parent;
var parent = Parent.Parent;
while (parent != null)
{
if (parent._entityType == _relationship.MemberType)
@ -333,7 +333,7 @@ namespace Marr.Data
// * Only 1-1 entities with no children are allowed to have 0 PKs specified.
if ((groupingKeyColumns.PrimaryKeys.Count == 0 && _children.Count > 0) ||
(groupingKeyColumns.PrimaryKeys.Count == 0 && !IsRoot && _relationship.RelationshipInfo.RelationType == RelationshipTypes.Many))
throw new MissingPrimaryKeyException(string.Format("There are no primary key mappings defined for the following entity: '{0}'.", this.EntityType.Name));
throw new MissingPrimaryKeyException(string.Format("There are no primary key mappings defined for the following entity: '{0}'.", EntityType.Name));
// Add parent's keys
if (IsChild)
@ -378,7 +378,7 @@ namespace Marr.Data
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
return GetEnumerator();
}
#endregion

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Marr.Data.Mapping;
@ -74,9 +75,9 @@ namespace Marr.Data
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
return GetEnumerator();
}
#endregion

@ -53,10 +53,10 @@ namespace Marr.Data
ReflectionStrategy = new SimpleReflectionStrategy();
// Register a default type converter for Enums
TypeConverters.Add(typeof(Enum), new Converters.EnumStringConverter());
TypeConverters.Add(typeof(Enum), new EnumStringConverter());
// Register a default IDbTypeBuilder
_dbTypeBuilder = new Parameters.DbTypeBuilder();
_dbTypeBuilder = new DbTypeBuilder();
_columnMapStrategies = new Dictionary<Type, IMapStrategy>();
RegisterDefaultMapStrategy(new AttributeMapStrategy());

@ -1,4 +1,6 @@
namespace Marr.Data.Mapping
using System.Data;
namespace Marr.Data.Mapping
{
public class ColumnInfo : IColumnInfo
{
@ -7,7 +9,7 @@
IsPrimaryKey = false;
IsAutoIncrement = false;
ReturnValue = false;
ParamDirection = System.Data.ParameterDirection.Input;
ParamDirection = ParameterDirection.Input;
}
public string Name { get; set; }
@ -16,7 +18,7 @@
public bool IsPrimaryKey { get; set; }
public bool IsAutoIncrement { get; set; }
public bool ReturnValue { get; set; }
public System.Data.ParameterDirection ParamDirection { get; set; }
public ParameterDirection ParamDirection { get; set; }
public string TryGetAltName()
{

@ -30,12 +30,12 @@ namespace Marr.Data.Mapping
public ColumnMap GetByColumnName(string columnName)
{
return this.Find(m => m.ColumnInfo.Name == columnName);
return Find(m => m.ColumnInfo.Name == columnName);
}
public ColumnMap GetByFieldName(string fieldName)
{
return this.Find(m => m.FieldName == fieldName);
return Find(m => m.FieldName == fieldName);
}
/// <summary>
@ -107,7 +107,7 @@ namespace Marr.Data.Mapping
/// <returns>A list of mapped columns that are present in the sql statement as parameters.</returns>
public ColumnMapCollection OrderParameters(DbCommand command)
{
if (command.CommandType == CommandType.Text && this.Count > 0)
if (command.CommandType == CommandType.Text && Count > 0)
{
string commandTypeString = command.GetType().ToString();
if (commandTypeString.Contains("Oracle") || commandTypeString.Contains("OleDb"))
@ -120,7 +120,7 @@ namespace Marr.Data.Mapping
Regex regex = new Regex(regexString);
foreach (Match m in regex.Matches(command.CommandText))
{
ColumnMap matchingColumn = this.Find(c => string.Concat(paramPrefix, c.ColumnInfo.Name.ToLower()) == m.Value.ToLower());
ColumnMap matchingColumn = Find(c => string.Concat(paramPrefix, c.ColumnInfo.Name.ToLower()) == m.Value.ToLower());
if (matchingColumn != null)
columns.Add(matchingColumn);
}
@ -148,7 +148,7 @@ namespace Marr.Data.Mapping
/// <returns></returns>
public ColumnMapCollection PrefixAltNames(string prefix)
{
this.ForEach(c => c.ColumnInfo.AltName = c.ColumnInfo.Name.Insert(0, prefix));
ForEach(c => c.ColumnInfo.AltName = c.ColumnInfo.Name.Insert(0, prefix));
return this;
}
@ -163,7 +163,7 @@ namespace Marr.Data.Mapping
/// <returns></returns>
public ColumnMapCollection SuffixAltNames(string suffix)
{
this.ForEach(c => c.ColumnInfo.AltName = c.ColumnInfo.Name + suffix);
ForEach(c => c.ColumnInfo.AltName = c.ColumnInfo.Name + suffix);
return this;
}

@ -55,9 +55,9 @@ namespace Marr.Data.Mapping
public class MappingsFluentColumns<TEntity>
{
private bool _publicOnly;
private FluentMappings.MappingsFluentEntity<TEntity> _fluentEntity;
private MappingsFluentEntity<TEntity> _fluentEntity;
public MappingsFluentColumns(FluentMappings.MappingsFluentEntity<TEntity> fluentEntity, bool publicOnly)
public MappingsFluentColumns(MappingsFluentEntity<TEntity> fluentEntity, bool publicOnly)
{
_fluentEntity = fluentEntity;
_publicOnly = publicOnly;
@ -122,9 +122,9 @@ namespace Marr.Data.Mapping
public class MappingsFluentTables<TEntity>
{
private FluentMappings.MappingsFluentEntity<TEntity> _fluentEntity;
private MappingsFluentEntity<TEntity> _fluentEntity;
public MappingsFluentTables(FluentMappings.MappingsFluentEntity<TEntity> fluentEntity)
public MappingsFluentTables(MappingsFluentEntity<TEntity> fluentEntity)
{
_fluentEntity = fluentEntity;
}
@ -152,10 +152,10 @@ namespace Marr.Data.Mapping
public class MappingsFluentRelationships<TEntity>
{
private FluentMappings.MappingsFluentEntity<TEntity> _fluentEntity;
private MappingsFluentEntity<TEntity> _fluentEntity;
private bool _publicOnly;
public MappingsFluentRelationships(FluentMappings.MappingsFluentEntity<TEntity> fluentEntity, bool publicOnly)
public MappingsFluentRelationships(MappingsFluentEntity<TEntity> fluentEntity, bool publicOnly)
{
_fluentEntity = fluentEntity;
_publicOnly = publicOnly;

@ -14,6 +14,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
using System;
using System.Collections;
using System.Reflection;
using Marr.Data.Reflection;
@ -35,7 +36,7 @@ namespace Marr.Data.Mapping
// Try to determine the RelationshipType
if (relationshipInfo.RelationType == RelationshipTypes.AutoDetect)
{
if (typeof(System.Collections.ICollection).IsAssignableFrom(MemberType))
if (typeof(ICollection).IsAssignableFrom(MemberType))
{
relationshipInfo.RelationType = RelationshipTypes.Many;
}

@ -28,7 +28,7 @@ namespace Marr.Data.Mapping
{
get
{
return this.Find(m => m.Member.Name == fieldName);
return Find(m => m.Member.Name == fieldName);
}
}
}

@ -27,7 +27,7 @@ namespace Marr.Data.Mapping.Strategies
protected override void CreateColumnMap(Type entityType, System.Reflection.MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
{
if (ColumnPredicate(member))
{
@ -36,7 +36,7 @@ namespace Marr.Data.Mapping.Strategies
}
}
protected override void CreateRelationship(Type entityType, System.Reflection.MemberInfo member, RelationshipAttribute relationshipAtt, RelationshipCollection relationships)
protected override void CreateRelationship(Type entityType, MemberInfo member, RelationshipAttribute relationshipAtt, RelationshipCollection relationships)
{
if (RelationshipPredicate(member))
{

@ -14,6 +14,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
using System;
using System.Collections;
using System.Reflection;
namespace Marr.Data.Mapping.Strategies
@ -70,7 +71,7 @@ namespace Marr.Data.Mapping.Strategies
if (member.MemberType == MemberTypes.Property)
{
PropertyInfo propertyInfo = member as PropertyInfo;
if (typeof(System.Collections.ICollection).IsAssignableFrom(propertyInfo.PropertyType))
if (typeof(ICollection).IsAssignableFrom(propertyInfo.PropertyType))
{
Relationship relationship = new Relationship(member);
relationships.Add(relationship);

@ -62,7 +62,7 @@ namespace Marr.Data.Parameters
return DbType.Object;
}
public void SetDbType(System.Data.IDbDataParameter param, Enum dbType)
public void SetDbType(IDbDataParameter param, Enum dbType)
{
param.DbType = (DbType)dbType;
}

@ -14,6 +14,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
using System;
using System.Data;
using System.Data.OleDb;
namespace Marr.Data.Parameters
@ -59,7 +60,7 @@ namespace Marr.Data.Parameters
return OleDbType.Variant;
}
public void SetDbType(System.Data.IDbDataParameter param, Enum dbType)
public void SetDbType(IDbDataParameter param, Enum dbType)
{
var oleDbParam = (OleDbParameter)param;
oleDbParam.OleDbType = (OleDbType)dbType;

@ -63,7 +63,7 @@ namespace Marr.Data.Parameters
return SqlDbType.Variant;
}
public void SetDbType(System.Data.IDbDataParameter param, Enum dbType)
public void SetDbType(IDbDataParameter param, Enum dbType)
{
var sqlDbParam = (SqlParameter)param;
sqlDbParam.SqlDbType = (SqlDbType)dbType;

@ -1,4 +1,6 @@
namespace Marr.Data.QGen
using Marr.Data.QGen.Dialects;
namespace Marr.Data.QGen
{
/// <summary>
/// This class creates a SQL delete query.
@ -7,9 +9,9 @@
{
protected Table TargetTable { get; set; }
protected string WhereClause { get; set; }
protected Dialects.Dialect Dialect { get; set; }
protected Dialect Dialect { get; set; }
public DeleteQuery(Dialects.Dialect dialect, Table targetTable, string whereClause)
public DeleteQuery(Dialect dialect, Table targetTable, string whereClause)
{
Dialect = dialect;
TargetTable = targetTable;

@ -35,7 +35,7 @@ namespace Marr.Data.QGen
case ExpressionType.Not:
case ExpressionType.Quote:
case ExpressionType.TypeAs:
return this.VisitUnary((UnaryExpression)expression);
return VisitUnary((UnaryExpression)expression);
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.And:
@ -60,15 +60,15 @@ namespace Marr.Data.QGen
case ExpressionType.RightShift:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
return this.VisitBinary((BinaryExpression)expression);
return VisitBinary((BinaryExpression)expression);
case ExpressionType.Call:
return this.VisitMethodCall((MethodCallExpression)expression);
return VisitMethodCall((MethodCallExpression)expression);
case ExpressionType.Constant:
return this.VisitConstant((ConstantExpression)expression);
return VisitConstant((ConstantExpression)expression);
case ExpressionType.MemberAccess:
return this.VisitMemberAccess((MemberExpression)expression);
return VisitMemberAccess((MemberExpression)expression);
case ExpressionType.Parameter:
return this.VisitParameter((ParameterExpression)expression);
return VisitParameter((ParameterExpression)expression);
}
throw new ArgumentOutOfRangeException("expression", expression.NodeType.ToString());
@ -111,8 +111,8 @@ namespace Marr.Data.QGen
/// <returns></returns>
protected virtual Expression VisitBinary(BinaryExpression expression)
{
this.Visit(expression.Left);
this.Visit(expression.Right);
Visit(expression.Left);
Visit(expression.Right);
return expression;
}
@ -123,7 +123,7 @@ namespace Marr.Data.QGen
/// <returns></returns>
protected virtual Expression VisitUnary(UnaryExpression expression)
{
this.Visit(expression.Operand);
Visit(expression.Operand);
return expression;
}
@ -134,7 +134,7 @@ namespace Marr.Data.QGen
/// <returns></returns>
protected virtual Expression VisitLamda(LambdaExpression lambdaExpression)
{
this.Visit(lambdaExpression.Body);
Visit(lambdaExpression.Body);
return lambdaExpression;
}

@ -2,6 +2,7 @@
using System.Collections.Generic;
using Marr.Data.Mapping;
using System.Linq.Expressions;
using Marr.Data.QGen.Dialects;
namespace Marr.Data.QGen
{
@ -15,7 +16,7 @@ namespace Marr.Data.QGen
private SqlModes _previousSqlMode;
private bool _generateQuery = true;
private bool _getIdentityValue;
private Dialects.Dialect _dialect;
private Dialect _dialect;
private ColumnMapCollection _columnsToInsert;
public InsertQueryBuilder()

@ -6,6 +6,7 @@ using System.Reflection;
using Marr.Data.Mapping;
using System.Data.Common;
using System.Collections;
using Marr.Data.QGen.Dialects;
namespace Marr.Data.QGen
{
@ -19,7 +20,7 @@ namespace Marr.Data.QGen
#region - Private Members -
private DataMapper _db;
private Dialects.Dialect _dialect;
private Dialect _dialect;
private TableCollection _tables;
private WhereBuilder<T> _whereBuilder;
private SortBuilder<T> _sortBuilder;
@ -71,7 +72,7 @@ namespace Marr.Data.QGen
// Used only for unit testing with mock frameworks
}
public QueryBuilder(DataMapper db, Dialects.Dialect dialect)
public QueryBuilder(DataMapper db, Dialect dialect)
{
_db = db;
_dialect = dialect;
@ -499,7 +500,7 @@ namespace Marr.Data.QGen
/// </summary>
/// <param name="expression"></param>
/// <returns></returns>
protected override System.Linq.Expressions.Expression Visit(System.Linq.Expressions.Expression expression)
protected override Expression Visit(Expression expression)
{
return base.Visit(expression);
}
@ -509,9 +510,9 @@ namespace Marr.Data.QGen
/// </summary>
/// <param name="lambdaExpression"></param>
/// <returns></returns>
protected override System.Linq.Expressions.Expression VisitLamda(System.Linq.Expressions.LambdaExpression lambdaExpression)
protected override Expression VisitLamda(LambdaExpression lambdaExpression)
{
_sortBuilder = this.Where(lambdaExpression as Expression<Func<T, bool>>);
_sortBuilder = Where(lambdaExpression as Expression<Func<T, bool>>);
return base.VisitLamda(lambdaExpression);
}
@ -520,16 +521,16 @@ namespace Marr.Data.QGen
/// </summary>
/// <param name="expression"></param>
/// <returns></returns>
protected override System.Linq.Expressions.Expression VisitMethodCall(MethodCallExpression expression)
protected override Expression VisitMethodCall(MethodCallExpression expression)
{
if (expression.Method.Name == "OrderBy" || expression.Method.Name == "ThenBy")
{
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as System.Linq.Expressions.LambdaExpression).Body as System.Linq.Expressions.MemberExpression;
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as LambdaExpression).Body as MemberExpression;
_sortBuilder.Order(memberExp.Expression.Type, memberExp.Member.Name);
}
if (expression.Method.Name == "OrderByDescending" || expression.Method.Name == "ThenByDescending")
{
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as System.Linq.Expressions.LambdaExpression).Body as System.Linq.Expressions.MemberExpression;
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as LambdaExpression).Body as MemberExpression;
_sortBuilder.OrderByDescending(memberExp.Expression.Type, memberExp.Member.Name);
}
@ -540,14 +541,14 @@ namespace Marr.Data.QGen
{
_isJoin = true;
MemberInfo rightMember = (rightEntity.Body as MemberExpression).Member;
return this.Join(joinType, rightMember, filterExpression);
return Join(joinType, rightMember, filterExpression);
}
public virtual QueryBuilder<T> Join<TLeft, TRight>(JoinType joinType, Expression<Func<TLeft, TRight>> rightEntity, Expression<Func<TLeft, TRight, bool>> filterExpression)
{
_isJoin = true;
MemberInfo rightMember = (rightEntity.Body as MemberExpression).Member;
return this.Join(joinType, rightMember, filterExpression);
return Join(joinType, rightMember, filterExpression);
}
public virtual QueryBuilder<T> Join<TLeft, TRight>(JoinType joinType, MemberInfo rightMember, Expression<Func<TLeft, TRight, bool>> filterExpression)
@ -598,7 +599,7 @@ namespace Marr.Data.QGen
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
var list = this.ToList();
var list = ToList();
return list.GetEnumerator();
}
@ -608,7 +609,7 @@ namespace Marr.Data.QGen
IEnumerator IEnumerable.GetEnumerator()
{
var list = this.ToList();
var list = ToList();
return list.GetEnumerator();
}

@ -1,4 +1,5 @@
using System;
using Marr.Data.Mapping;
using Marr.Data.QGen.Dialects;
namespace Marr.Data.QGen
@ -16,19 +17,19 @@ namespace Marr.Data.QGen
private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory";
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
public static IQuery CreateUpdateQuery(Mapping.ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
{
Dialect dialect = CreateDialect(dataMapper);
return new UpdateQuery(dialect, columns, dataMapper.Command, target, whereClause);
}
public static IQuery CreateInsertQuery(Mapping.ColumnMapCollection columns, IDataMapper dataMapper, string target)
public static IQuery CreateInsertQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target)
{
Dialect dialect = CreateDialect(dataMapper);
return new InsertQuery(dialect, columns, dataMapper.Command, target);
}
public static IQuery CreateDeleteQuery(Dialects.Dialect dialect, Table targetTable, string whereClause)
public static IQuery CreateDeleteQuery(Dialect dialect, Table targetTable, string whereClause)
{
return new DeleteQuery(dialect, targetTable, whereClause);
}
@ -81,7 +82,7 @@ namespace Marr.Data.QGen
}
}
public static Dialects.Dialect CreateDialect(IDataMapper dataMapper)
public static Dialect CreateDialect(IDataMapper dataMapper)
{
string providerString = dataMapper.ProviderFactory.ToString();
switch (providerString)

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq.Expressions;
@ -243,7 +244,7 @@ namespace Marr.Data.QGen
public virtual IEnumerator<T> GetEnumerator()
{
var list = this.ToList();
var list = ToList();
return list.GetEnumerator();
}
@ -251,7 +252,7 @@ namespace Marr.Data.QGen
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}

@ -41,7 +41,7 @@ namespace Marr.Data.QGen
/// </summary>
public Table FindTable(Type declaringType)
{
return this.EnumerateViewsAndTables().Where(t => t.EntityType == declaringType).FirstOrDefault();
return EnumerateViewsAndTables().Where(t => t.EntityType == declaringType).FirstOrDefault();
}
public Table this[int index]

@ -2,6 +2,7 @@
using System.Collections.Generic;
using Marr.Data.Mapping;
using System.Linq.Expressions;
using Marr.Data.QGen.Dialects;
namespace Marr.Data.QGen
{
@ -16,7 +17,7 @@ namespace Marr.Data.QGen
private bool _generateQuery = true;
private TableCollection _tables;
private Expression<Func<T, bool>> _filterExpression;
private Dialects.Dialect _dialect;
private Dialect _dialect;
private ColumnMapCollection _columnsToUpdate;
public UpdateQueryBuilder()

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Marr.Data.Mapping;
@ -11,7 +12,7 @@ namespace Marr.Data.QGen
{
private string _viewName;
private Table[] _tables;
private Mapping.ColumnMapCollection _columns;
private ColumnMapCollection _columns;
public View(string viewName, Table[] tables)
: base(tables[0].EntityType, JoinType.None)
@ -58,7 +59,7 @@ namespace Marr.Data.QGen
/// <summary>
/// Gets all the columns from all the tables included in the view.
/// </summary>
public override Mapping.ColumnMapCollection Columns
public override ColumnMapCollection Columns
{
get
{
@ -81,9 +82,9 @@ namespace Marr.Data.QGen
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
return GetEnumerator();
}
}
}

@ -78,7 +78,7 @@ namespace Marr.Data.QGen
protected override Expression VisitMethodCall(MethodCallExpression expression)
{
string method = (expression as System.Linq.Expressions.MethodCallExpression).Method.Name;
string method = (expression as MethodCallExpression).Method.Name;
switch (method)
{
case "Contains":
@ -270,7 +270,7 @@ namespace Marr.Data.QGen
internal void Append(WhereBuilder<T> where, WhereAppendType appendType)
{
_constantWhereClause = string.Format("{0} {1} {2}",
this.ToString(),
ToString(),
appendType.ToString(),
where.ToString().Replace("WHERE ", string.Empty));
}

@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;
namespace Marr.Data
{
@ -118,8 +119,8 @@ namespace Marr.Data
public NestedSharedContextRollBackException(string message) : base(message) { }
public NestedSharedContextRollBackException(string message, Exception inner) : base(message, inner) { }
protected NestedSharedContextRollBackException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
SerializationInfo info,
StreamingContext context)
: base(info, context) { }
}
}

@ -21,6 +21,7 @@ using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Update;
using NzbDrone.Test.Common;
using System.Linq;
@ -31,7 +32,7 @@ namespace NzbDrone.Api.Test.MappingTests
public class ResourceMappingFixture : TestBase
{
[TestCase(typeof(Core.Tv.Series), typeof(SeriesResource))]
[TestCase(typeof(Core.Tv.Episode), typeof(EpisodeResource))]
[TestCase(typeof(Episode), typeof(EpisodeResource))]
[TestCase(typeof(RootFolder), typeof(RootFolderResource))]
[TestCase(typeof(NamingConfig), typeof(NamingConfigResource))]
[TestCase(typeof(Indexer), typeof(IndexerResource))]

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using NzbDrone.Api.REST;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Series
@ -22,7 +23,7 @@ namespace NzbDrone.Api.Series
public DateTime? NextAiring { get; set; }
public String Network { get; set; }
public String AirTime { get; set; }
public List<Core.MediaCover.MediaCover> Images { get; set; }
public List<MediaCover> Images { get; set; }
public String RemotePoster { get; set; }

@ -17,7 +17,7 @@ namespace NzbDrone.Api
/// <returns>INancyEngine implementation</returns>
protected override sealed INancyEngine GetEngineInternal()
{
return this.ApplicationContainer.Resolve<INancyEngine>();
return ApplicationContainer.Resolve<INancyEngine>();
}
/// <summary>
@ -26,7 +26,7 @@ namespace NzbDrone.Api
/// <returns>IModuleKeyGenerator instance</returns>
protected override sealed IModuleKeyGenerator GetModuleKeyGenerator()
{
return this.ApplicationContainer.Resolve<IModuleKeyGenerator>();
return ApplicationContainer.Resolve<IModuleKeyGenerator>();
}
/// <summary>
@ -114,7 +114,7 @@ namespace NzbDrone.Api
/// <returns>Request container instance</returns>
protected override sealed TinyIoCContainer CreateRequestContainer()
{
return this.ApplicationContainer.GetChildContainer();
return ApplicationContainer.GetChildContainer();
}
/// <summary>
@ -123,7 +123,7 @@ namespace NzbDrone.Api
/// <returns>IDagnostics implementation</returns>
protected override IDiagnostics GetDiagnostics()
{
return this.ApplicationContainer.Resolve<IDiagnostics>();
return ApplicationContainer.Resolve<IDiagnostics>();
}
/// <summary>
@ -132,7 +132,7 @@ namespace NzbDrone.Api
/// <returns>An <see cref="IEnumerable{T}"/> instance containing <see cref="IApplicationStartup"/> instances. </returns>
protected override IEnumerable<IApplicationStartup> GetApplicationStartupTasks()
{
return this.ApplicationContainer.ResolveAll<IApplicationStartup>(false);
return ApplicationContainer.ResolveAll<IApplicationStartup>(false);
}
/// <summary>
@ -141,7 +141,7 @@ namespace NzbDrone.Api
/// <returns>An <see cref="IEnumerable{T}"/> instance containing <see cref="IApplicationRegistrations"/> instances.</returns>
protected override IEnumerable<IApplicationRegistrations> GetApplicationRegistrationTasks()
{
return this.ApplicationContainer.ResolveAll<IApplicationRegistrations>(false);
return ApplicationContainer.ResolveAll<IApplicationRegistrations>(false);
}
/// <summary>

@ -1,4 +1,5 @@
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
@ -53,7 +54,7 @@ namespace NzbDrone.Common
var byteSize = (length / 4) * 3;
var linkBytes = new byte[byteSize];
var rngCrypto = new System.Security.Cryptography.RNGCryptoServiceProvider();
var rngCrypto = new RNGCryptoServiceProvider();
rngCrypto.GetBytes(linkBytes);
var base64String = Convert.ToBase64String(linkBytes);

@ -42,7 +42,7 @@ namespace NzbDrone.Common.Instrumentation
}
protected override void Write(NLog.LogEventInfo logEvent)
protected override void Write(LogEventInfo logEvent)
{
var dictionary = new Dictionary<string, object>();

@ -1,3 +1,4 @@
using System.Text;
using System.Text.RegularExpressions;
namespace NzbDrone.Common
@ -38,8 +39,8 @@ namespace NzbDrone.Common
public static string RemoveAccent(this string txt)
{
var bytes = System.Text.Encoding.GetEncoding("Cyrillic").GetBytes(txt);
return System.Text.Encoding.ASCII.GetString(bytes);
var bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt);
return Encoding.ASCII.GetString(bytes);
}
}
}

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Configuration
public ConfigFileProvider(IAppFolderInfo appFolderInfo, ICacheManger cacheManger)
{
_appFolderInfo = appFolderInfo;
_cache = cacheManger.GetCache<string>(this.GetType());
_cache = cacheManger.GetCache<string>(GetType());
_configFile = _appFolderInfo.GetConfigPath();
}

@ -74,18 +74,18 @@ namespace NzbDrone.Core.Indexers
public void CheckForError()
{
if (this.MoveToContent() == XmlNodeType.Element)
if (MoveToContent() == XmlNodeType.Element)
{
if (this.Name != "error")
if (Name != "error")
return;
var message = "Error: ";
if (this.HasAttributes)
if (HasAttributes)
{
while (this.MoveToNextAttribute())
while (MoveToNextAttribute())
{
message += String.Format(" [{0}:{1}]", this.Name, this.Value);
message += String.Format(" [{0}:{1}]", Name, Value);
}
}

@ -6,6 +6,7 @@ using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Test.Common;
using NzbDrone.Update.UpdateEngine;
using IServiceProvider = NzbDrone.Common.IServiceProvider;
namespace NzbDrone.Update.Test
{
@ -19,7 +20,7 @@ namespace NzbDrone.Update.Test
Subject.Start(AppType.Service, targetFolder);
Mocker.GetMock<Common.IServiceProvider>().Verify(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once());
Mocker.GetMock<IServiceProvider>().Verify(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once());
}
@ -28,7 +29,7 @@ namespace NzbDrone.Update.Test
{
const string targetFolder = "c:\\NzbDrone\\";
Mocker.GetMock<Common.IServiceProvider>().Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME)).Throws(new InvalidOperationException());
Mocker.GetMock<IServiceProvider>().Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME)).Throws(new InvalidOperationException());
Subject.Start(AppType.Service, targetFolder);

Loading…
Cancel
Save