2011-12-14 5 views
1

私はIBsonSerializerを実装するクラスを持っている:mongodb C#ドライバ内のオブジェクトをシリアル化するためにwcfシリアライザを使用するにはどうすればよいですか?

public class PersistentObject : IBsonSerializer 
    { 
     public object Id { get; set; } 

     public object Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) 
     { 
      throw new NotImplementedException(); 
     } 

     public object Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) 
     { 
      throw new NotImplementedException(); 
     } 

     public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator) 
     { 
      throw new NotImplementedException(); 
     } 

     public void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options) 
     { 
      throw new NotImplementedException(); 
     } 

     public void SetDocumentId(object document, object id) 
     { 
      throw new NotImplementedException(); 
     } 

    } 

はそれがシリアル化を実装し、WCFシリアライザを使用する方法をデシリアライズすることは可能ですか?

+1

私はそれを取得しません。 WCFシリアライザは外部(あなたのアプリケーションを別のアプリケーションに)話すべきですが、BsonSerializerはデータベースとだけ話すべきです。 WCFをMongoDB接続に「変換」できるようにアダプタを作成しようとしていますか? – mnemosyn

+0

私はBsonSerializerをJsonSerializerを使用して、またはJSON形式にオブジェクトをシリアル化すると思いますが、それは正しいですか?それが正しい場合、オブジェクトをシリアル化するためにDataContractSerializerを使用できますか? –

+0

私は 'DataContractSerializer'について詳しくは分かりませんが、私はさまざまなレベルの問題に取り組んでいます。その間にアプリケーションロジック、検証、および承認を管理するコントローラが必要です。なぜあなたは 'DataContractシリアライザ' btwが必要ですか?あなたはREST APIを構築していますか? – mnemosyn

答えて

関連する問題