From 81c4915d161b1897a2ba9efe6ab3afff34cd35f7 Mon Sep 17 00:00:00 2001 From: Grzegorz Russek Date: Fri, 24 Jan 2025 16:03:30 +0100 Subject: [PATCH] Small improvements --- AmalgamationTool/DynamORM.Amalgamation.cs | 44 +++-------------------- DynamORM/Mapper/DynamicPropertyInvoker.cs | 8 ++--- 2 files changed, 9 insertions(+), 43 deletions(-) diff --git a/AmalgamationTool/DynamORM.Amalgamation.cs b/AmalgamationTool/DynamORM.Amalgamation.cs index 7090941..2e47ddb 100644 --- a/AmalgamationTool/DynamORM.Amalgamation.cs +++ b/AmalgamationTool/DynamORM.Amalgamation.cs @@ -6002,33 +6002,6 @@ namespace DynamORM : base(string.Format("{0}{1}{2}", message, Environment.NewLine, command != null ? command.DumpToString() : string.Empty), innerException) { } - - /// Initializes a new instance of the - /// class. - /// The - /// that holds the serialized object data about the exception being thrown. - /// The - /// that contains contextual information about the source or destination. - public DynamicQueryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - - /// When overridden in a derived class, sets the - /// - /// with information about the exception. - /// The - /// that holds the serialized object data about the exception being thrown. - /// The - /// that contains contextual information about the source or destination. - /// - /// - /// - /// - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - } } /// Stores information about column from database schema. @@ -13327,7 +13300,7 @@ namespace DynamORM catch (TargetInvocationException e) { if (e.InnerException != null) throw e.InnerException; - else throw e; + throw; } } @@ -14014,13 +13987,6 @@ namespace DynamORM public DynamicMapperException(string message, Exception innerException) : base(message, innerException) { } - - /// Initializes a new instance of the class. - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected DynamicMapperException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } } /// Dynamic property invoker. @@ -14110,10 +14076,10 @@ namespace DynamORM private Func CreateGetter(PropertyInfo property) { - if (!property.CanRead) + if (property == null || !property.CanRead) return null; - ParameterExpression objParm = Expression.Parameter(typeof(object), "o"); + var objParm = Expression.Parameter(typeof(object), "o"); return Expression.Lambda>( Expression.Convert( @@ -14128,8 +14094,8 @@ namespace DynamORM if (!property.CanWrite) return null; - ParameterExpression objParm = Expression.Parameter(typeof(object), "o"); - ParameterExpression valueParm = Expression.Parameter(typeof(object), "value"); + var objParm = Expression.Parameter(typeof(object), "o"); + var valueParm = Expression.Parameter(typeof(object), "value"); return Expression.Lambda>( Expression.Assign( diff --git a/DynamORM/Mapper/DynamicPropertyInvoker.cs b/DynamORM/Mapper/DynamicPropertyInvoker.cs index 29f5d09..047ca2d 100644 --- a/DynamORM/Mapper/DynamicPropertyInvoker.cs +++ b/DynamORM/Mapper/DynamicPropertyInvoker.cs @@ -123,10 +123,10 @@ namespace DynamORM.Mapper private Func CreateGetter(PropertyInfo property) { - if (!property.CanRead) + if (property == null || !property.CanRead) return null; - ParameterExpression objParm = Expression.Parameter(typeof(object), "o"); + var objParm = Expression.Parameter(typeof(object), "o"); return Expression.Lambda>( Expression.Convert( @@ -141,8 +141,8 @@ namespace DynamORM.Mapper if (!property.CanWrite) return null; - ParameterExpression objParm = Expression.Parameter(typeof(object), "o"); - ParameterExpression valueParm = Expression.Parameter(typeof(object), "value"); + var objParm = Expression.Parameter(typeof(object), "o"); + var valueParm = Expression.Parameter(typeof(object), "value"); return Expression.Lambda>( Expression.Assign(