mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-17 05:12:13 +08:00
aecffecae1
* attempt NRT makeover - annotate NRTs on GridReader API - add protected access to some of the GridReader internals - switch GridReader callbacks to be more type-independent docs lib updates; deal with yellow warnings and test failures (SQL server certs and cancellation surfacing differently) fix break simplify proposed GridReader changes to protected OnBeforeGrid and OnAfterGrid[Async] Builds: Bump library versions (#1935) Tests: Upgrade dependencies for Dependabot (#1936) I'll do a pass at all of these later, but getting CVE versions out of the pipe. Resolving 4 alerts here: https://github.com/DapperLib/Dapper/security/dependabot merge and lib updates allow Identity to be constructed on-the-fly inside GridReader fix build warnings include readme rev minor - enable [SkipLocalsInit] everywhere - use NET5_0_OR_GREATER for remoting check # Conflicts: # Dapper/CommandDefinition.cs # Dapper/DefaultTypeMap.cs # Dapper/SqlMapper.Async.cs # Dapper/SqlMapper.IDataReader.cs # Dapper/SqlMapper.Link.cs # Dapper/SqlMapper.cs # Directory.Build.props * shipped, not unshipped * fixup SqlBuilder; use is null / is not null * use central package management (#1949) * Nullable test tweaks * Nuget: let's just remove it! * 2 test fixes from review * fix FindExplicitConstructor * add GetPropertySetterOrThrow * fix NRT on FindConstructor * DapperRow: value is object? * use NotNullWhen * make constructor problem more obvious * test fixes --------- Co-authored-by: Nick Craver <nrcraver@gmail.com>
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System.Xml;
|
|
using System.Xml.Linq;
|
|
using Xunit;
|
|
|
|
namespace Dapper.Tests
|
|
{
|
|
[Collection("XmlTests")]
|
|
public sealed class SystemSqlClientXmlTests : XmlTests<SystemSqlClientProvider> { }
|
|
#if MSSQLCLIENT
|
|
[Collection("XmlTests")]
|
|
public sealed class MicrosoftSqlClientXmlTests : XmlTests<MicrosoftSqlClientProvider> { }
|
|
#endif
|
|
public abstract class XmlTests<TProvider> : TestBase<TProvider> where TProvider : DatabaseProvider
|
|
{
|
|
[Fact]
|
|
public void CommonXmlTypesSupported()
|
|
{
|
|
var xml = new XmlDocument();
|
|
xml.LoadXml("<abc/>");
|
|
|
|
var foo = new Foo
|
|
{
|
|
A = xml,
|
|
B = XDocument.Parse("<def/>"),
|
|
C = XElement.Parse("<ghi/>")
|
|
};
|
|
var bar = connection.QuerySingle<Foo>("select @a as [A], @b as [B], @c as [C]", new { a = foo.A, b = foo.B, c = foo.C });
|
|
Assert.Equal("abc", bar.A?.DocumentElement?.Name);
|
|
Assert.Equal("def", bar.B?.Root?.Name.LocalName);
|
|
Assert.Equal("ghi", bar.C?.Name.LocalName);
|
|
}
|
|
|
|
public class Foo
|
|
{
|
|
public XmlDocument? A { get; set; }
|
|
public XDocument? B { get; set; }
|
|
public XElement? C { get; set; }
|
|
}
|
|
}
|
|
}
|