1. Andrew Rondeau
  2. MongoDB.Emitter

Source

MongoDB.Emitter / MongoDB.Emitter.Test / SimpleDocument_Sample.cs

/*
MongoDB.Emitter:  Emits strongly-typed wrappers for MongoDB.Driver.Document objects
http://objectcloud.com
(C) 2010 Andrew Rondeau
MIT License  (Open Source)
*/

using System;
using System.Collections.Generic;
using System.Text;

using MongoDB.Driver;
using MongoDB.Emitter;

namespace MongoDB.Emitter.Test
{
    /// <summary>
    /// This class isn't used.  It's de-compiled using ILDasm to learn the proper op-codes
    /// </summary>
    public class SimpleDocument_Sample : DocumentWrapper, ISimpleDocument
    {
        public SimpleDocument_Sample(
            Document document,
            WrapperFactory wrapperFactory)
            : base(document, wrapperFactory) { }

        public long? TheLong
        {
            get
            {
                return ConvertTo<long?>(_Document["TheLong"]);
            }
            set
            {
                _Document["TheLong"] = ConvertFrom<long?>(value);
            }
        }

        public bool TheLong_IsPresent
        {
            get { return _Document.Contains("TheLong"); }
            set { base.SetContains(value, "TheLong"); }
        }

        public DateTime? TheDateTime
        {
            get
            {
                return ConvertTo<DateTime?>(_Document["TheDateTime"]);
            }
            set
            {
                _Document["TheDateTime"] = ConvertFrom<DateTime?>(value);
            }
        }

        public string TheString
        {
            get
            {
                return ConvertTo<string>(_Document["TheString"]);
            }
            set
            {
                _Document["TheString"] = ConvertFrom<string>(value);
            }
        }


        public double? TheDouble
        {
            get
            {
                return ConvertTo<double?>(_Document["TheDouble"]);
            }
            set
            {
                _Document["TheDouble"] = ConvertFrom<double?>(value);
            }
        }

        public bool? TheBool
        {
            get
            {
                return ConvertTo<bool?>(_Document["TheBool"]);
            }
            set
            {
                _Document["TheBool"] = ConvertFrom<bool?>(value);
            }
        }

        public byte[] TheByteArray
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        public Guid TheGuid
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        public ArrayWrapper<string> TheArray
        {
            get
            {
                _TheArray = GetArrayWrapper<string>("TheArray", _TheArray);
                return _TheArray;
            }
            set
            {
                _Document["TheArray"] = value.MongoArray;
                _TheArray = value;
            }
        }
        private ArrayWrapper<string> _TheArray;

        #region ISimpleDocument Members


        public Document AnotherDocument
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        #endregion

        #region ISimpleDocument Members


        public IAnotherSimpleDocument AnotherSimpleDocument
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        #endregion

        #region ISimpleDocument Members


        public DictionaryWrapper<int> SimpleDictionary
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        #endregion

        #region ISimpleDocument Members


        public ArrayWrapper<IAnotherSimpleDocument> ManySimpleDocuments
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        public DictionaryWrapper<IAnotherSimpleDocument> NamedSimpleDocuments
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        #endregion

        #region ISimpleDocument Members


        public TimeSpan TheTimeSpan
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        #endregion

        public Oid _id
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}