From fdcf88247a553d495976a87bf860fab7aed200b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pon=20Cheol=20Ku=20=28=EA=B5=AC=EB=B3=B8=EC=B2=A0=29?= Date: Sat, 16 Jul 2022 13:13:52 +0900 Subject: [PATCH] Remove JsonService #16 --- Abstractions/IJsonService.cs | 48 +++++++------ AppContainerBuilder.cs | 4 +- ContentPageBase.cs | 1 - README.md | 5 ++ Services/JsonService.cs | 107 +++++++++++++++------------- Validations/IsNotNullOrEmptyRule.cs | 1 - kr.bbon.Xamarin.Forms.csproj | 3 +- 7 files changed, 91 insertions(+), 78 deletions(-) diff --git a/Abstractions/IJsonService.cs b/Abstractions/IJsonService.cs index f949cb2..b7e3e8c 100644 --- a/Abstractions/IJsonService.cs +++ b/Abstractions/IJsonService.cs @@ -1,24 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Text; +/** + * Remove JsonService #16 + * + */ +//using System; +//using System.Collections.Generic; +//using System.Text; -namespace kr.bbon.Xamarin.Forms.Abstractions -{ - public interface IJsonService - { - /// - /// 직렬화 합니다. - /// - /// - /// - string Serialize(object obj); +//namespace kr.bbon.Xamarin.Forms.Abstractions +//{ +// public interface IJsonService +// { +// /// +// /// 직렬화 합니다. +// /// +// /// +// /// +// string Serialize(object obj); - /// - /// 역직렬화합니다. - /// - /// - /// - /// - T Deserialize(string json); - } -} +// /// +// /// 역직렬화합니다. +// /// +// /// +// /// +// /// +// T Deserialize(string json); +// } +//} diff --git a/AppContainerBuilder.cs b/AppContainerBuilder.cs index b1a9f3e..5add410 100644 --- a/AppContainerBuilder.cs +++ b/AppContainerBuilder.cs @@ -34,7 +34,9 @@ protected virtual void Register(ContainerBuilder builder) { builder.RegisterType().As(); builder.RegisterType().As(); - builder.RegisterType().As(); + + // Remove JsonService #16 + //builder.RegisterType().As(); } private readonly ContainerBuilder containerBuilder; diff --git a/ContentPageBase.cs b/ContentPageBase.cs index dc6e063..0d94c7a 100644 --- a/ContentPageBase.cs +++ b/ContentPageBase.cs @@ -4,7 +4,6 @@ using System.Text; using System.Threading.Tasks; using Autofac; -using kr.bbon.Xamarin.Forms.Abstractions; using Xamarin.Forms; namespace kr.bbon.Xamarin.Forms diff --git a/README.md b/README.md index 75502b7..a9e5b3a 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,11 @@ ## 변경 Changes +### 1.2.0 + +- JsonService 제거 +- Newtonsoft.Json 의존 제거 + ### 1.1.2 - 패키지 이미지 추가 diff --git a/Services/JsonService.cs b/Services/JsonService.cs index 1dd0614..ab3bb4f 100644 --- a/Services/JsonService.cs +++ b/Services/JsonService.cs @@ -1,56 +1,61 @@ -using kr.bbon.Xamarin.Forms.Abstractions; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Text; +/** + * Remove JsonService #16 + * + */ -namespace kr.bbon.Xamarin.Forms.Services -{ - public class JsonService: IJsonService - { - /// - /// 직렬화 합니다. - /// - /// - /// - public string Serialize(object obj) - { - return JsonConvert.SerializeObject(obj, GetDefaultSettings()); - } +//using kr.bbon.Xamarin.Forms.Abstractions; +//using Newtonsoft.Json; +//using Newtonsoft.Json.Serialization; +//using System; +//using System.Collections.Generic; +//using System.Text; - /// - /// 역직렬화합니다. - /// - /// - /// - /// - public T Deserialize(string json) - { - T obj = JsonConvert.DeserializeObject(json, GetDefaultSettings()); +//namespace kr.bbon.Xamarin.Forms.Services +//{ +// public class JsonService: IJsonService +// { +// /// +// /// 직렬화 합니다. +// /// +// /// +// /// +// public string Serialize(object obj) +// { +// return JsonConvert.SerializeObject(obj, GetDefaultSettings()); +// } - return obj; - } +// /// +// /// 역직렬화합니다. +// /// +// /// +// /// +// /// +// public T Deserialize(string json) +// { +// T obj = JsonConvert.DeserializeObject(json, GetDefaultSettings()); - private JsonSerializerSettings GetDefaultSettings() - { - return new JsonSerializerSettings - { - // JSON 객체 속성 이름을 camelCase 형태로 처리합니다. - ContractResolver = new CamelCasePropertyNamesContractResolver(), - // 열거형 값을 문자열로 저장합니다. - //options.Converters.Add(new StringEnumConverter()); - // 들여쓰기 형식을 지원합니다. - Formatting = Formatting.Indented, - // null 값을 가진 속성에 대한 직렬화/역직렬화 과정의 에러를 무시합니다. - NullValueHandling = NullValueHandling.Ignore, - // 정의되지 않은 멤버에 대한 직렬화/역직렬화 과정의 에러를 무시합니다. - MissingMemberHandling = MissingMemberHandling.Ignore, +// return obj; +// } - DateParseHandling = DateParseHandling.DateTimeOffset, - DateFormatHandling = DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = DateTimeZoneHandling.Utc, - }; - } - } -} +// private JsonSerializerSettings GetDefaultSettings() +// { +// return new JsonSerializerSettings +// { +// // JSON 객체 속성 이름을 camelCase 형태로 처리합니다. +// ContractResolver = new CamelCasePropertyNamesContractResolver(), +// // 열거형 값을 문자열로 저장합니다. +// //options.Converters.Add(new StringEnumConverter()); +// // 들여쓰기 형식을 지원합니다. +// Formatting = Formatting.Indented, +// // null 값을 가진 속성에 대한 직렬화/역직렬화 과정의 에러를 무시합니다. +// NullValueHandling = NullValueHandling.Ignore, +// // 정의되지 않은 멤버에 대한 직렬화/역직렬화 과정의 에러를 무시합니다. +// MissingMemberHandling = MissingMemberHandling.Ignore, + +// DateParseHandling = DateParseHandling.DateTimeOffset, +// DateFormatHandling = DateFormatHandling.IsoDateFormat, +// DateTimeZoneHandling = DateTimeZoneHandling.Utc, +// }; +// } +// } +//} diff --git a/Validations/IsNotNullOrEmptyRule.cs b/Validations/IsNotNullOrEmptyRule.cs index cad1657..94d2da1 100644 --- a/Validations/IsNotNullOrEmptyRule.cs +++ b/Validations/IsNotNullOrEmptyRule.cs @@ -15,7 +15,6 @@ public bool Check(T value) return false; } - // TODO ToString() 이 더 좋을 것으로 생각됨 var str = value as string ?? value.ToString(); return !String.IsNullOrWhiteSpace(str); diff --git a/kr.bbon.Xamarin.Forms.csproj b/kr.bbon.Xamarin.Forms.csproj index c8dfa18..4b926bb 100644 --- a/kr.bbon.Xamarin.Forms.csproj +++ b/kr.bbon.Xamarin.Forms.csproj @@ -4,7 +4,7 @@ netstandard2.0 kr.bbon.Xamarin.Forms kr.bbon.Xamarin.Forms - 1.1.2 + 1.2.0 Pon Cheol Ku (bbon@live.com) bbon.kr bbon.kr. All rights reserved. @@ -24,7 +24,6 @@ -