From f9c1c42ebd8c317ce51e7cf4526c4375d08eae5c Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Tue, 2 Dec 2014 00:38:36 +0100 Subject: [PATCH] Lowered req to .Net4, upgraded dapper & T4Include --- src/SqlBulkSync/SqlBulkSync/App.config | 6 +- .../SqlBulkSync/Include_T4Include.cs | 71 +++++++++---------- .../SqlBulkSync/Include_T4Include.tt | 2 +- .../SqlBulkSync/Properties/AssemblyInfo.cs | 4 +- .../SqlBulkSync/SqlBulkSync.csproj | 6 +- src/SqlBulkSync/SqlBulkSync/SyncRunner.cs | 14 +++- src/SqlBulkSync/SqlBulkSync/packages.config | 2 +- 7 files changed, 57 insertions(+), 48 deletions(-) diff --git a/src/SqlBulkSync/SqlBulkSync/App.config b/src/SqlBulkSync/SqlBulkSync/App.config index 9c05822..74ade9d 100644 --- a/src/SqlBulkSync/SqlBulkSync/App.config +++ b/src/SqlBulkSync/SqlBulkSync/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/src/SqlBulkSync/SqlBulkSync/Include_T4Include.cs b/src/SqlBulkSync/SqlBulkSync/Include_T4Include.cs index a649d65..3adcb9e 100644 --- a/src/SqlBulkSync/SqlBulkSync/Include_T4Include.cs +++ b/src/SqlBulkSync/SqlBulkSync/Include_T4Include.cs @@ -5,7 +5,7 @@ // # # // # This means that any edits to the .cs file will be lost when its # // # regenerated. Changes should instead be applied to the corresponding # -// # text template file (.tt) # +// # text template file (.tt) # // ############################################################################ @@ -59,6 +59,9 @@ // Certains directives such as #define and // Resharper comments has to be // moved to top in order to work properly // ############################################################################ +#pragma warning disable 0618 +#pragma warning disable 612, 618 +#pragma warning disable 618 // ReSharper disable InconsistentNaming // ReSharper disable PartialMethodWithSinglePart // ReSharper disable PartialTypeWithSinglePart @@ -3369,7 +3372,7 @@ internal sealed class AssemblyNeutralAttribute : Attribute { } public enum CommandFlags { /// - /// No additonal flags + /// No additional flags /// None = 0, /// @@ -3599,7 +3602,7 @@ public interface IParameterLookup : IDynamicParameters } /// - /// Extends IDynamicParameters with facitilies for executing callbacks after commands have completed + /// Extends IDynamicParameters with facilities for executing callbacks after commands have completed /// public partial interface IParameterCallbacks : IDynamicParameters { @@ -3713,7 +3716,7 @@ object ITypeHandler.Parse(Type destinationType, object value) } /// - /// Implement this interface to change default mapping of reader columns to type memebers + /// Implement this interface to change default mapping of reader columns to type members /// public interface ITypeMap { @@ -3730,7 +3733,7 @@ public interface ITypeMap /// /// Parameters will be default values, nulls for reference types and zero'd for value types. /// - /// Use this class to force object creation away from parameterless constructors you dn't control. + /// Use this class to force object creation away from parameterless constructors you don't control. /// ConstructorInfo FindExplicitConstructor(); @@ -4071,7 +4074,7 @@ public static void ResetTypeHandlers() AddTypeHandlerImpl(typeof(DataTable), new DataTableHandler(), true); } /// - /// Configire the specified type to be mapped to a given db-type + /// Configure the specified type to be mapped to a given db-type /// public static void AddTypeMap(Type type, DbType dbType) { @@ -4087,7 +4090,7 @@ public static void AddTypeMap(Type type, DbType dbType) } /// - /// Configire the specified type to be processed by a custom handler + /// Configure the specified type to be processed by a custom handler /// public static void AddTypeHandler(Type type, ITypeHandler handler) { @@ -4095,7 +4098,7 @@ public static void AddTypeHandler(Type type, ITypeHandler handler) } /// - /// Configire the specified type to be processed by a custom handler + /// Configure the specified type to be processed by a custom handler /// public static void AddTypeHandlerImpl(Type type, ITypeHandler handler, bool clone) { @@ -4123,13 +4126,11 @@ public static void AddTypeHandlerImpl(Type type, ITypeHandler handler, bool clon var newCopy = clone ? new Dictionary(snapshot) : snapshot; - #pragma warning disable 618 typeof(TypeHandlerCache<>).MakeGenericType(type).GetMethod("SetHandler", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { handler }); if(secondary != null) { typeof(TypeHandlerCache<>).MakeGenericType(secondary).GetMethod("SetHandler", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { handler }); } - #pragma warning restore 618 if (handler == null) { newCopy.Remove(type); @@ -4144,7 +4145,7 @@ public static void AddTypeHandlerImpl(Type type, ITypeHandler handler, bool clon } /// - /// Configire the specified type to be processed by a custom handler + /// Configure the specified type to be processed by a custom handler /// public static void AddTypeHandler(TypeHandler handler) { @@ -4179,9 +4180,7 @@ public static void SetValue(IDbDataParameter parameter, object value) internal static void SetHandler(ITypeHandler handler) { - #pragma warning disable 618 TypeHandlerCache.handler = handler; - #pragma warning restore 618 } private static ITypeHandler handler; @@ -4249,7 +4248,7 @@ internal static DbType LookupDbType(Type type, string name, bool demand, out ITy } /// - /// Identity of a cached query in Dapper, used for extensability + /// Identity of a cached query in Dapper, used for extensibility /// public partial class Identity : IEquatable { @@ -4936,8 +4935,8 @@ private static IEnumerable QueryImpl(this IDbConnection cnn, CommandDefini /// /// Maps a query to objects /// - /// The first type in the recordset - /// The second type in the recordset + /// The first type in the record set + /// The second type in the record set /// The return type /// /// @@ -5104,7 +5103,7 @@ public static IEnumerable QueryThe return type /// /// - /// array of types in the recordset + /// array of types in the record set /// /// /// @@ -6243,9 +6242,7 @@ internal static void ReplaceLiterals(IParameterLookup parameters, IDbCommand com foreach (var token in tokens) { object value = parameters[token.Member]; - #pragma warning disable 0618 string text = Format(value); - #pragma warning restore 0618 sql = sql.Replace(token.Token, text); } command.CommandText = sql; @@ -6494,9 +6491,7 @@ internal static Action CreateParamInfoGenerator(Identity ide if (handler != null) { - #pragma warning disable 618 il.Emit(OpCodes.Call, typeof(TypeHandlerCache<>).MakeGenericType(prop.PropertyType).GetMethod("SetValue")); // stack is now [parameters] [[parameters]] [parameter] - #pragma warning restore 618 } else { @@ -6582,7 +6577,7 @@ internal static Action CreateParamInfoGenerator(Identity ide case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: - // neeed to stloc, ldloca, call + // need to stloc, ldloca, call // re-use existing locals (both the last known, and via a dictionary) var convert = GetToString(typeCode); if (local == null || local.LocalType != propType) @@ -6729,7 +6724,6 @@ private static Action GetParameterReader(IDbConnection cnn, private static Func GetStructDeserializer(Type type, Type effectiveType, int index) { // no point using special per-type handling here; it boils down to the same, plus not all are supported anyway (see: SqlDataReader.GetChar - not supported!) - #pragma warning disable 618 if (type == typeof(char)) { // this *does* need special handling, though return r => SqlMapper.ReadChar(r.GetValue(index)); @@ -6742,7 +6736,6 @@ private static Func GetStructDeserializer(Type type, Type e { return r => Activator.CreateInstance(type, r.GetValue(index)); } - #pragma warning restore 618 if (effectiveType.IsEnum) { // assume the value is returned as the correct type (int/byte/etc), but box back to the typed enum @@ -7070,9 +7063,7 @@ public static Func GetTypeDeserializer( { if (hasTypeHandler) { - #pragma warning disable 618 il.EmitCall(OpCodes.Call, typeof(TypeHandlerCache<>).MakeGenericType(unboxType).GetMethod("Parse"), null); // stack is now [target][target][typed-value] - #pragma warning restore 618 } else { @@ -7416,7 +7407,7 @@ private static void EmitInt32(ILGenerator il, int value) /// /// How should connection strings be compared for equivalence? Defaults to StringComparer.Ordinal. /// Providing a custom implementation can be useful for allowing multi-tenancy databases with identical - /// schema to share startegies. Note that usual equivalence rules apply: any equivalent connection strings + /// schema to share strategies. Note that usual equivalence rules apply: any equivalent connection strings /// MUST yield the same hash-code. /// public static IEqualityComparer ConnectionStringComparer @@ -7536,7 +7527,7 @@ private IEnumerable MultiReadInternal - /// Read multiple objects from a single recordset on the grid + /// Read multiple objects from a single record set on the grid /// public IEnumerable Read(Func func, string splitOn) { @@ -7544,7 +7535,7 @@ public IEnumerable Read(Func - /// Read multiple objects from a single recordset on the grid + /// Read multiple objects from a single record set on the grid /// #if CSHARP30 public IEnumerable Read(Func func, string splitOn, bool buffered) @@ -7558,7 +7549,7 @@ public IEnumerable Read(Func - /// Read multiple objects from a single recordset on the grid + /// Read multiple objects from a single record set on the grid /// public IEnumerable Read(Func func, string splitOn) { @@ -7566,7 +7557,7 @@ public IEnumerable Read(Func - /// Read multiple objects from a single recordset on the grid + /// Read multiple objects from a single record set on the grid /// #if CSHARP30 public IEnumerable Read(Func func, string splitOn, bool buffered) @@ -7978,9 +7969,7 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity) if (dbType == null && val != null && !isCustomQueryParameter) dbType = SqlMapper.LookupDbType(val.GetType(), name, true, out handler); if (dbType == DynamicParameters.EnumerableMultiParameter) { - #pragma warning disable 612, 618 SqlMapper.PackListParameters(command, name, val); - #pragma warning restore 612, 618 } else if (isCustomQueryParameter) { @@ -8392,7 +8381,7 @@ private static readonly FeatureSupport postgres = new FeatureSupport(true); /// - /// Gets the featureset based on the passed connection + /// Gets the feature set based on the passed connection /// public static FeatureSupport Get(IDbConnection connection) { @@ -8411,7 +8400,7 @@ private FeatureSupport(bool arrays) } /// - /// Represents simple memeber map for one of target parameter or property or field to source DataReader column + /// Represents simple member map for one of target parameter or property or field to source DataReader column /// sealed partial class SimpleMemberMap : SqlMapper.IMemberMap { @@ -8728,7 +8717,7 @@ public ConstructorInfo FindExplicitConstructor() } /// - /// Not impelmeneted as far as default constructor used for all cases + /// Not implemented as far as default constructor used for all cases /// /// /// @@ -9176,14 +9165,20 @@ static string GetLevelMessage (Level level) } // @@@ END_INCLUDE: https://raw.github.com/mrange/T4Include/master/Common/Generated_Log.cs // ############################################################################ - +// ############################################################################ +// Certains directives such as #define and // Resharper comments has to be +// moved to bottom in order to work properly +// ############################################################################ +#pragma warning restore 0618 +#pragma warning restore 612, 618 +#pragma warning restore 618 // ############################################################################ namespace WCOM.SqlBulkSync.Include { static partial class MetaData { public const string RootPath = @"https://raw.github.com/"; - public const string IncludeDate = @"2014-11-12T23:39:56"; + public const string IncludeDate = @"2014-12-02T00:34:15"; public const string Include_0 = @"https://raw.github.com/mrange/T4Include/master/Extensions/BasicExtensions.cs"; public const string Include_1 = @"https://raw.github.com/mrange/T4Include/master/Common/SubString.cs"; diff --git a/src/SqlBulkSync/SqlBulkSync/Include_T4Include.tt b/src/SqlBulkSync/SqlBulkSync/Include_T4Include.tt index ae8e5c6..de86b16 100644 --- a/src/SqlBulkSync/SqlBulkSync/Include_T4Include.tt +++ b/src/SqlBulkSync/SqlBulkSync/Include_T4Include.tt @@ -23,4 +23,4 @@ }; #> -<#@ include file="$(SolutionDir)\packages\T4Include.1.1.2\T4\IncludeWebFile.ttinclude" #> \ No newline at end of file +<#@ include file="$(SolutionDir)\packages\T4Include.1.1.4\T4\IncludeWebFile.ttinclude" #> \ No newline at end of file diff --git a/src/SqlBulkSync/SqlBulkSync/Properties/AssemblyInfo.cs b/src/SqlBulkSync/SqlBulkSync/Properties/AssemblyInfo.cs index 240ebc6..22b6426 100644 --- a/src/SqlBulkSync/SqlBulkSync/Properties/AssemblyInfo.cs +++ b/src/SqlBulkSync/SqlBulkSync/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] +[assembly: AssemblyVersion("1.0.2")] +[assembly: AssemblyFileVersion("1.0.2")] diff --git a/src/SqlBulkSync/SqlBulkSync/SqlBulkSync.csproj b/src/SqlBulkSync/SqlBulkSync/SqlBulkSync.csproj index cf56dd0..983ccb5 100644 --- a/src/SqlBulkSync/SqlBulkSync/SqlBulkSync.csproj +++ b/src/SqlBulkSync/SqlBulkSync/SqlBulkSync.csproj @@ -9,9 +9,11 @@ Properties WCOM.SqlBulkSync SqlBulkSync - v4.5.1 + v4.0 512 true + + AnyCPU @@ -22,6 +24,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -31,6 +34,7 @@ TRACE prompt 4 + false wcom.ico diff --git a/src/SqlBulkSync/SqlBulkSync/SyncRunner.cs b/src/SqlBulkSync/SqlBulkSync/SyncRunner.cs index 3bace00..3327cef 100644 --- a/src/SqlBulkSync/SqlBulkSync/SyncRunner.cs +++ b/src/SqlBulkSync/SqlBulkSync/SyncRunner.cs @@ -45,7 +45,12 @@ private static void ProcessSync(SyncJob syncJob) sourceConn.Database ); sourceConn.Open(); - Log.Success("Connected {0}", sourceConn.ClientConnectionId); + Log.Success( + "Connected {0}.{1} ({2})", + sourceConn.DataSource, + sourceConn.Database, + sourceConn.ServerVersion + ); Log.Info( "Connecting to target database {0}.{1}", @@ -53,7 +58,12 @@ private static void ProcessSync(SyncJob syncJob) targetConn.Database ); targetConn.Open(); - Log.Success("Connected {0}", targetConn.ClientConnectionId); + Log.Success( + "Connected {0}.{1} ({2})", + targetConn.DataSource, + targetConn.Database, + targetConn.ServerVersion + ); Log.Info("Fetching table schemas"); var schemaStopWatch = Stopwatch.StartNew(); diff --git a/src/SqlBulkSync/SqlBulkSync/packages.config b/src/SqlBulkSync/SqlBulkSync/packages.config index cf99957..97933a8 100644 --- a/src/SqlBulkSync/SqlBulkSync/packages.config +++ b/src/SqlBulkSync/SqlBulkSync/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file