public SelectDataFromCaseExpression(SqlSearchedCaseExpression caseExpression, RawData rawData) { _Expression = caseExpression; _RawData = rawData; if (_Expression.ElseExpression != null) { _FullTypeInfo = Helper.DetermineFullTypeInfo(_Expression.ElseExpression, rawData); _ScalarExpression = _Expression.ElseExpression; } if (_Expression.ElseExpression == null || _FullTypeInfo.DbDataType == null) { var whenExpression = _Expression.WhenClauses.First( ); _FullTypeInfo = Helper.DetermineFullTypeInfo(whenExpression.ThenExpression, rawData); _ScalarExpression = whenExpression.ThenExpression; } }
private static IEnumerable <FullTypeInfo> TypeAndBaseTypesExceptObject(FullTypeInfo type) { if (type.Type == null || type.Type == typeof(object)) { yield break; } while (true) { yield return(type); type.Type = type.TypeInfo.BaseType; if (type.Type == null || type.Type == typeof(object)) { yield break; } type.TypeInfo = type.Type.GetTypeInfo(); } }
private static bool OverridesEquals(FullTypeInfo specificType) { foreach (var type in TypeAndBaseTypesExceptObject(specificType)) { foreach (var method in type.TypeInfo.DeclaredMethods) { if (!method.IsPublic || method.IsStatic || !method.IsVirtual || !method.IsHideBySig || method.Name != "Equals") { continue; } var baseDefinition = method.GetRuntimeBaseDefinition(); if (baseDefinition.Equals(method)) { continue; } if (baseDefinition.DeclaringType == typeof(object)) { return(true); } } } return(false); }
private static IEnumerable<FullTypeInfo> TypeAndBaseTypesExceptObject(FullTypeInfo type) { if (type.Type == null || type.Type == typeof(object)) yield break; while (true) { yield return type; type.Type = type.TypeInfo.BaseType; if (type.Type == null || type.Type == typeof(object)) yield break; type.TypeInfo = type.Type.GetTypeInfo(); } }
private static bool OverridesEquals(FullTypeInfo specificType) { foreach (var type in TypeAndBaseTypesExceptObject(specificType)) { foreach (var method in type.TypeInfo.DeclaredMethods) { if (!method.IsPublic || method.IsStatic || !method.IsVirtual || !method.IsHideBySig || !method.Name.Equals("Equals", StringComparison.Ordinal)) continue; var baseDefinition = method.GetRuntimeBaseDefinition(); if (baseDefinition == method) continue; if (baseDefinition.DeclaringType == typeof(object)) return true; } } return false; }