diff --git a/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfiguration.cs b/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfiguration.cs index cf6a5ad38..a5f83c25e 100644 --- a/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfiguration.cs +++ b/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfiguration.cs @@ -146,7 +146,7 @@ public static LocalizationConfiguration Load(IConfiguration configuration, strin return new LocalizationConfigurationReader().Read(configurationRoot, sectionName ?? DefaultSectionName); } else if (configuration is IConfigurationSection configurationSection) { - return sectionName.IsNullOrEmpty() + return string.IsNullOrEmpty(sectionName) ? new LocalizationConfigurationReader().Read(configurationSection) : new LocalizationConfigurationReader().Read(configurationSection.GetSection(sectionName)); } diff --git a/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfigurationReader.cs b/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfigurationReader.cs index 0b7fce453..7dd8dddd0 100644 --- a/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfigurationReader.cs +++ b/Extensions/Xtensive.Orm.Localization/Configuration/LocalizationConfigurationReader.cs @@ -52,7 +52,7 @@ private LocalizationConfiguration ReadInternal(IConfigurationSection configurati } } } - if(!cultureName.IsNullOrEmpty()) { + if(!string.IsNullOrEmpty(cultureName)) { try { defaultCulture = CultureInfo.GetCultureInfo(cultureName); } @@ -64,4 +64,4 @@ private LocalizationConfiguration ReadInternal(IConfigurationSection configurati return new LocalizationConfiguration() { DefaultCulture = defaultCulture }; } } -} \ No newline at end of file +} diff --git a/Extensions/Xtensive.Orm.Security/Configuration/SecurityConfigurationReaders.cs b/Extensions/Xtensive.Orm.Security/Configuration/SecurityConfigurationReaders.cs index 8597af275..6dfbdbbaa 100644 --- a/Extensions/Xtensive.Orm.Security/Configuration/SecurityConfigurationReaders.cs +++ b/Extensions/Xtensive.Orm.Security/Configuration/SecurityConfigurationReaders.cs @@ -68,11 +68,11 @@ protected override SecurityConfiguration ReadInternal(IConfigurationSection conf } if ((hashingServiceName ?? authenticationServiceName) != null) { var securityConfiguration = new SecurityConfiguration(true); - if (!hashingServiceName.IsNullOrEmpty()) { + if (!string.IsNullOrEmpty(hashingServiceName)) { securityConfiguration.HashingServiceName = hashingServiceName.ToLowerInvariant(); } - if (!authenticationServiceName.IsNullOrEmpty()) { + if (!string.IsNullOrEmpty(authenticationServiceName)) { securityConfiguration.AuthenticationServiceName = authenticationServiceName.ToLowerInvariant(); } diff --git a/Orm/Xtensive.Orm.Oracle/Sql.Drivers.Oracle/v09/Compiler.cs b/Orm/Xtensive.Orm.Oracle/Sql.Drivers.Oracle/v09/Compiler.cs index f1d495d75..ff126c8bf 100644 --- a/Orm/Xtensive.Orm.Oracle/Sql.Drivers.Oracle/v09/Compiler.cs +++ b/Orm/Xtensive.Orm.Oracle/Sql.Drivers.Oracle/v09/Compiler.cs @@ -292,7 +292,7 @@ public override void Visit(SqlFastFirstRowsHint node) => public override void Visit(SqlForceJoinOrderHint node) { - if (node.Tables.IsNullOrEmpty()) { + if (!(node.Tables?.Count > 0)) { _ = context.Output.Append("ORDERED"); } else { @@ -583,4 +583,4 @@ protected internal Compiler(SqlDriver driver) { } } -} \ No newline at end of file +} diff --git a/Orm/Xtensive.Orm.Tests/Issues/IssueJira0627_PocoClassPropertyRenitialization.cs b/Orm/Xtensive.Orm.Tests/Issues/IssueJira0627_PocoClassPropertyRenitialization.cs index bd6ddbc37..d4d4e6919 100644 --- a/Orm/Xtensive.Orm.Tests/Issues/IssueJira0627_PocoClassPropertyRenitialization.cs +++ b/Orm/Xtensive.Orm.Tests/Issues/IssueJira0627_PocoClassPropertyRenitialization.cs @@ -1133,7 +1133,7 @@ public void AllByFieldOfPoco01Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name }) - .All(el => el.Name.IsNullOrEmpty()); + .All(el => string.IsNullOrEmpty(el.Name)); } } @@ -1144,7 +1144,7 @@ public void AllByFieldOfPoco02Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .All(el => el.Name.IsNullOrEmpty()); + .All(el => string.IsNullOrEmpty(el.Name)); } } @@ -1155,7 +1155,7 @@ public void AllByFieldOfPoco03Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .All(el => el.Name.IsNullOrEmpty()); + .All(el => string.IsNullOrEmpty(el.Name)); } } @@ -1166,7 +1166,7 @@ public void AllByFieldOfPoco04Test() using (var transaction = session.OpenTransaction()) { _ = Assert.Throws(() => session.Query.All() .Select(e => new Poco { BaseName = e.Name }) - .All(el => el.Name.IsNullOrEmpty())); + .All(el => string.IsNullOrEmpty(el.Name))); } } @@ -1177,7 +1177,7 @@ public void AllByFieldOfPoco05Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco()) - .All(el => el.Name.IsNullOrEmpty()); + .All(el => string.IsNullOrEmpty(el.Name)); } } @@ -1189,7 +1189,7 @@ public void AnyByFieldOfPoco01Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name }) - .Any(el => el.Name.IsNullOrEmpty()); + .Any(el => string.IsNullOrEmpty(el.Name)); } } @@ -1200,7 +1200,7 @@ public void AnyByFieldOfPoco02Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .Any(el => el.Name.IsNullOrEmpty()); + .Any(el => string.IsNullOrEmpty(el.Name)); } } @@ -1211,7 +1211,7 @@ public void AnyByFieldOfPoco03Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .Any(el => el.BaseName.IsNullOrEmpty()); + .Any(el => string.IsNullOrEmpty(el.BaseName)); } } @@ -1222,7 +1222,7 @@ public void AnyByFieldOfPoco04Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { BaseName = e.Name }) - .Any(el => el.BaseName.IsNullOrEmpty()); + .Any(el => string.IsNullOrEmpty(el.BaseName)); } } @@ -1233,7 +1233,7 @@ public void AnyByFieldOfPoco05Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco()) - .Any(el => el.Name.IsNullOrEmpty()); + .Any(el => string.IsNullOrEmpty(el.Name)); } } @@ -1347,7 +1347,7 @@ public void CountByFieldOfPoco01Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name }) - .Count(el => el.Name.IsNullOrEmpty()); + .Count(el => string.IsNullOrEmpty(el.Name)); } } @@ -1358,7 +1358,7 @@ public void CountByFieldOfPoco02Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .Count(el => el.Name.IsNullOrEmpty()); + .Count(el => string.IsNullOrEmpty(el.Name)); } } @@ -1369,7 +1369,7 @@ public void CountByFieldOfPoco03Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { Name = e.Name, BaseName = e.Name }) - .Count(el => el.BaseName.IsNullOrEmpty()); + .Count(el => string.IsNullOrEmpty(el.BaseName)); } } @@ -1380,7 +1380,7 @@ public void CountByFieldOfPoco04Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco { BaseName = e.Name }) - .Count(el => el.BaseName.IsNullOrEmpty()); + .Count(el => string.IsNullOrEmpty(el.BaseName)); } } @@ -1391,7 +1391,7 @@ public void CountByFieldOfPoco05Test() using (var transaction = session.OpenTransaction()) { _ = session.Query.All() .Select(e => new Poco()) - .Count(el => el.Name.IsNullOrEmpty()); + .Count(el => string.IsNullOrEmpty(el.Name)); } } diff --git a/Orm/Xtensive.Orm/Core/Extensions/EnumerableExtensions.cs b/Orm/Xtensive.Orm/Core/Extensions/EnumerableExtensions.cs index 29c36119d..3ff66c294 100644 --- a/Orm/Xtensive.Orm/Core/Extensions/EnumerableExtensions.cs +++ b/Orm/Xtensive.Orm/Core/Extensions/EnumerableExtensions.cs @@ -25,6 +25,9 @@ public static class EnumerableExtensions private const int defaultMaximalBatchSize = 1024; private const int defaultFirstFastCount = 0; + [Obsolete("Use string.IsNullOrEmpty()")] + internal static bool IsNullOrEmpty(this string s) => string.IsNullOrEmpty(s); + /// /// Indicates whether enumerable is empty or not /// by attempting to cast it to and . @@ -35,7 +38,7 @@ public static class EnumerableExtensions /// if collection is definitely or empty; /// otherwise, . [Obsolete("Don't use Xtensive.Core for 'collection is empty' checking")] - public static bool IsNullOrEmpty(this IEnumerable items) + internal static bool IsNullOrEmpty(this IEnumerable items) { if (items==null) return true; diff --git a/Orm/Xtensive.Orm/Orm/Linq/MemberCompilation/MemberCompilerProvider.cs b/Orm/Xtensive.Orm/Orm/Linq/MemberCompilation/MemberCompilerProvider.cs index 36c30f9dd..de151375c 100644 --- a/Orm/Xtensive.Orm/Orm/Linq/MemberCompilation/MemberCompilerProvider.cs +++ b/Orm/Xtensive.Orm/Orm/Linq/MemberCompilation/MemberCompilerProvider.cs @@ -184,7 +184,7 @@ private static (MemberInfo targetMember, Delegate compilerInvoker) ProcessCompil Strings.ExCompilerXHasInvalidTargetType, compiler.GetFullName(true))); var parameterTypes = ValidateCompilerParametersAndExtractTargetSignature(compiler, isGeneric); - var bindingFlags = BindingFlags.Public; + var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic; if (isCtor) bindingFlags |= BindingFlags.Instance; diff --git a/Orm/Xtensive.Orm/Sql/Dml/Hints/SqlForceJoinOrderHint.cs b/Orm/Xtensive.Orm/Sql/Dml/Hints/SqlForceJoinOrderHint.cs index 63752bf10..17c05c124 100644 --- a/Orm/Xtensive.Orm/Sql/Dml/Hints/SqlForceJoinOrderHint.cs +++ b/Orm/Xtensive.Orm/Sql/Dml/Hints/SqlForceJoinOrderHint.cs @@ -12,16 +12,14 @@ namespace Xtensive.Sql.Dml [Serializable] public class SqlForceJoinOrderHint : SqlHint { - private SqlTable[] tables; - /// /// Gets the corresponding tables. /// - public IEnumerable Tables { get { return tables; } } + public IReadOnlyList Tables { get; } internal override SqlForceJoinOrderHint Clone(SqlNodeCloneContext? context = null) => context.GetOrAdd(this, static (t, c) => - new(t.tables?.Select(table => table.Clone()).ToArray(t.tables.Length))); + new(t.Tables?.Select(table => table.Clone()).ToArray(t.Tables.Count))); public override void AcceptVisitor(ISqlVisitor visitor) { @@ -36,7 +34,7 @@ internal SqlForceJoinOrderHint() internal SqlForceJoinOrderHint(SqlTable[] tables) { - this.tables = tables; + Tables = tables; } } }