public DTObject Serialize(object instance, bool isPinned) { var dto = isPinned ? DTObject.Create() : DTObject.CreateReusable(); Serialize(instance, dto); return(dto); }
public DTObject GetOrCreateObject(string findExp) { var obj = GetObject(findExp, false); if (obj == null) { obj = this.IsPinned ? DTObject.Create() : DTObject.CreateReusable(); this.SetObject(findExp, obj); } return(obj); }
public DTObject Serialize(object instance, bool isPinned) { var dto = isPinned ? DTObject.Create() : DTObject.CreateReusable(); var serializable = instance as IDTOSerializable; if (serializable != null) { serializable.Serialize(dto, string.Empty); //string.Empty意味着 序列化的内容会完全替换dto } else { Serialize(instance, dto); } return(dto); }
/// <summary> /// 得到对象的不会被共生回收的版本 /// </summary> /// <returns></returns> public DTObject ToPinned() { return(this.IsPinned ? this : DTObject.Create(this.GetCode(), this.IsReadOnly)); }
public DTObject AsReadOnly() { var code = this.GetCode(); return(DTObject.Create(code, true)); }
/// <summary> /// 对象是否完全包含代码<paramref name="schemaCode"/>,这表示<paramref name="schemaCode"/>的所有成员都与目标对象一致 /// 待测试todo... /// </summary> /// <param name="schemaCode"></param> /// <returns></returns> public bool ContainsSchemaCode(string schemaCode) { var target = DTObject.Create(schemaCode); return(ContainsSchemaCode(target)); }