Exemplo n.º 1
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            SomeObjectModel             TheObject  = obj as SomeObjectModel;
            Dictionary <string, object> OutputJson = new Dictionary <string, object>();

            OutputJson.Add("SomeKey", TheObject.GetType().GetProperty(_theJsonDictionary["SomeKey"]).GetValue(TheObject));
            return(OutputJson);
        }
Exemplo n.º 2
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            SomeObjectModel             TheObject  = obj as SomeObjectModel;
            Dictionary <string, object> OutputJson = new Dictionary <string, object>();

            foreach (var item in _theJsonDictionary.Keys)
            {
                OutputJson.Add(item, TheObject.GetType().GetProperty(_theJsonDictionary[item]).GetValue(TheObject));
            }
            return(OutputJson);
        }
    void MakeSomeObjectWithModel(SomeObjectModel model)
    {
        SomeObject someObject = _someObjectPool.GetItem();

        if (_someObjectMutator.Mutate(someObject, model))
        {
            SomeObjectsPulledFromPool.Add(someObject);
        }
        else
        {
            throw new System.Exception("FAILED TO MUTATE");
        }
    }
Exemplo n.º 4
0
 public void UpdateModel(SomeObjectModel model)
 {
     Model = model;
 }
Exemplo n.º 5
0
 public SomeObject(int id)
 {
     Model    = new SomeObjectModel();
     Model.Id = id;
 }