C# 용 MongoRepository와의 상속을 시도 할 때 직렬화 오류가 발생합니다.MongoRepository 상속 직렬화 오류
정말 이상한 점은 짧은 시간 동안 작동하지만 재구성 또는 무언가가 실패한 후입니다. 컬렉션을 삭제하고 새 컬렉션을 만들면 중지 또는 다시 작성할 때까지 작동합니다. 내가받을
static MongoRepository<Organization> apps = new MongoRepository<Organization>();
return apps.Single(c => c.Id == id);
오류는 다음과 같습니다 :
유형의 예외를 '시스템
public class Organization { // other attributes removed for demonstration simplicity public List<Person> People { get;set; } } public abstract class Person { public string Id {get;set;} public string Name {get;set;} } public class Employee : Person { public string Badge {get;set;} } public class Contractor : Person { public string Company {get;set;} }
내가 그것을 좋아 얻을 때 : 같은
내 코드 보인다. IO.FileFormatException 'MongoDB.Driver.dll에서 발생했지만 사용자 코드에서 처리하지 않았습니다.
추가 정보 : API.Models.Organization 클래스의 People 속성을 deserialize하는 동안 오류가 발생했습니다. 추상 클래스의 인스턴스는 만들 수 없습니다.
다형성 클래스 작업 및 serilizing/deserialization에 대한 자세한 내용은 http://docs.mongodb.org/ecosystem/tutorial/serialize-documents-with-the-csharp-driver/#polymorphic-classes-and에서 확인할 수 있습니다. - 구분자 –