diff --git a/CsvSerializer/CsvSerializer.cs b/CsvSerializer/CsvSerializer.cs index 0d14c8c..bc5315d 100644 --- a/CsvSerializer/CsvSerializer.cs +++ b/CsvSerializer/CsvSerializer.cs @@ -6,9 +6,9 @@ using System.Security; using System.Text; -#if DEBUG +//#if DEBUG [assembly: InternalsVisibleTo("Tests")] -#endif +//#endif [assembly: InternalsVisibleTo("CsvSerializer.Dynamic")] [assembly: AllowPartiallyTrustedCallers] [assembly: SecurityTransparent] diff --git a/CsvSerializer/CsvSerializer.csproj b/CsvSerializer/CsvSerializer.csproj index 9e45e38..1dad737 100644 --- a/CsvSerializer/CsvSerializer.csproj +++ b/CsvSerializer/CsvSerializer.csproj @@ -15,7 +15,7 @@ https://github.com/ronnygunawan/csv-serializer csv serializer deserializer parser core Fast CSV to object serializer and deserializer. - 1.0.5 + 1.0.7 diff --git a/CsvSerializer/Internal/NativeImpl/SerializerFactory.cs b/CsvSerializer/Internal/NativeImpl/SerializerFactory.cs index ddb949c..afd67e7 100644 --- a/CsvSerializer/Internal/NativeImpl/SerializerFactory.cs +++ b/CsvSerializer/Internal/NativeImpl/SerializerFactory.cs @@ -14,14 +14,14 @@ internal static class SerializerFactory { public static ISerializer GetOrCreate() where T : notnull { if (_cache.TryGetValue(typeof(T), out ISerializer? serializer)) return serializer; - if (TypeHelper.IsInternalOrAnonymous()) { + //if (TypeHelper.IsInternalOrAnonymous()) { serializer = new NaiveSerializer(); - } else { - ImplEmitter implEmitter = new ImplEmitter($"S{typeof(T).GUID.ToString("N")}"); - implEmitter.ImplementAction("SerializeHeader", gen => DefineSerializeHeader(gen)); - implEmitter.ImplementAction("SerializeItem", gen => DefineSerializeItem(gen)); - serializer = implEmitter.CreateInstance(); - } + //} else { + // ImplEmitter implEmitter = new ImplEmitter($"S{typeof(T).GUID.ToString("N")}"); + // implEmitter.ImplementAction("SerializeHeader", gen => DefineSerializeHeader(gen)); + // implEmitter.ImplementAction("SerializeItem", gen => DefineSerializeItem(gen)); + // serializer = implEmitter.CreateInstance(); + //} _cache.TryAdd(typeof(T), serializer); return serializer; } diff --git a/Tests/InternationalizationTests.cs b/Tests/InternationalizationTests.cs index 523158e..d66a028 100644 --- a/Tests/InternationalizationTests.cs +++ b/Tests/InternationalizationTests.cs @@ -13,7 +13,7 @@ public void CanSerializeAndDeserializeInEN_USLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -28,7 +28,7 @@ public void CanSerializeAndDeserializeInEN_GBLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -43,7 +43,7 @@ public void CanSerializeAndDeserializeInID_IDLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -58,7 +58,7 @@ public void CanSerializeAndDeserializeInEN_INLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -73,7 +73,7 @@ public void CanSerializeAndDeserializeInFR_FRLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -88,7 +88,7 @@ public void CanSerializeAndDeserializeInDE_DELocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -103,7 +103,7 @@ public void CanSerializeAndDeserializeInZH_CNLocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0]; @@ -118,7 +118,7 @@ public void CanSerializeAndDeserializeInAR_SALocale() { Decimal = 123_456.789m, Double = 123_456.789 }; - string csv = CsvSerializer.Serialize(new[] { model }); + string csv = CsvSerializer.Serialize(new[] { model }, provider: provider); DecimalAndDouble[] deserialized = CsvSerializer.Deserialize(csv, provider: provider); deserialized.Length.Should().Be(1); model = deserialized[0];