프로젝트에서 이전 버전의 Sharp arch를 사용하고 있으며 JSON.NET을 사용하여 직렬화하려고합니다. JavascriptSerializer는 작동하지만 환경 설정에 JSON.NET을 선호합니다.json.net에서 s # arp EntityWithTypedId 클래스 만 표시하는 이유는 무엇입니까?
여기에 문제가 있습니다. 나는 다음 내가 할 간단한 샤프 오브젝트를 직렬화하려고 몇 가지 이유를 들어 : 나는 다음과 같은 JSON 변환을 실행하면
// my sharp object
[Serializable]
public class Contact : Entity
{
public virtual string EmailAddress { get; set; }
}
...
// in sharp, this is what happens to Entity
[Serializable]
public abstract class Entity : EntityWithTypedId<int> {
protected Entity();
}
// and then into EntityWithTypedId
[Serializable]
public abstract class EntityWithTypedId<IdT> : ValidatableObject, IEntityWithTypedId<IdT> {
protected EntityWithTypedId();
[JsonProperty]
[XmlIgnore]
public virtual IdT Id { get; protected set; }
public override bool Equals(object obj);
public override int GetHashCode();
protected override IEnumerable<PropertyInfo> GetTypeSpecificSignatureProperties();
public virtual bool IsTransient();
}
, 난 단지 다시 { "Id" : 0 }
결과를 얻을.
전체 개체 내용을 반환하는 방법에 대한 아이디어가 있으십니까?
그냥 [테스트] (https://github.com/seif/Sharp-Architecture/commit/c1757af64c19465e930b2c8f92e2b8ecbcce3a1d) 정확히 당신이 날카로운 아키텍처의 최신 버전과 객체가 올바르게 직렬화되었으므로 SharpArchitecture/Newtonsoft.Json의 어떤 버전을 사용하고 있습니까? –
안녕하세요, Attar, 현재 우리는 SharpArch.dll v1.6.0.0을 고수해야합니다. Newtonsoft.Json의 최신 버전. – sonjz