public static List <DTObject> CreateObjects(bool isPinned) { return(isPinned ? new List <DTObject>() : Symbiosis.TryMark(_objectsPool, () => { return new List <DTObject>(); })); }
public static Dictionary <string, object> CreateDictionary(bool isPinned) { return(isPinned ? new Dictionary <string, object>() : Symbiosis.TryMark(_dicValuePool, () => { return new Dictionary <string, object>(); })); }
public static List <DTEntity> CreateDTEntities(bool isPinned) { return(isPinned ? new List <DTEntity>() : Symbiosis.TryMark(_entitiesPool, () => { return new List <DTEntity>(); })); }
private RunContext GetRunContextFromAppSession(Guid runId) { var ctxs = AppSession.GetOrAddItem("RunContext", () => { var pool = DictionaryPool <Guid, RunContext> .Instance; return(Symbiosis.TryMark <Dictionary <Guid, RunContext> >(pool, () => { return new Dictionary <Guid, RunContext>(); })); }); RunContext ctx = null; if (!ctxs.TryGetValue(runId, out ctx)) { lock (ctxs) { if (!ctxs.TryGetValue(runId, out ctx)) { ctx = new RunContext(); ctxs.Add(runId, ctx); } } } return(ctx); }
/// <summary> /// 获得一个验证结果对象,该对象会与数据山下文共享生命周期 /// </summary> /// <returns></returns> public static ValidationResult Create() { return(Symbiosis.TryMark(_resultPool, () => { return new ValidationResult(); })); }
public static DTObjectList CreateObjectList(DTEList owner, bool isPinned) { var list = isPinned ? new DTObjectList() : Symbiosis.TryMark(_objectListPool, () => { return(new DTObjectList()); }); list.Init(owner, isPinned); return(list); }
public static DTObjects CreateDTOjects(IList <DTObject> items, bool isPinned) { var objs = isPinned ? new DTObjects() : Symbiosis.TryMark(_DTObjectsPool, () => { return(new DTObjects()); }); objs.SetList(items); return(objs); }
public static DTEList CreateDTEList(string name, DTObject template, DTObjectList items, bool isPinned) { var dte = isPinned ? new DTEList() : Symbiosis.TryMark(_dteListPool, () => { return(new DTEList()); }); dte.InitByClone(name, template, items, isPinned); return(dte); }
public static DTEList CreateDTEList(List <DTObject> members, bool isPinned) { var dte = isPinned ? new DTEList() : Symbiosis.TryMark(_dteListPool, () => { return(new DTEList()); }); dte.Init(isPinned, members); return(dte); }
public static DTEObject CreateDTEObject(bool isPinned) { var dte = isPinned ? new DTEObject() : Symbiosis.TryMark(_dteObjectPool, () => { return(new DTEObject()); }); dte.Init(isPinned); return(dte); }
/// <summary> /// 获取事件参数 /// </summary> /// <param name="objectType"></param> /// <param name="eventType"></param> /// <returns></returns> private static StatusEventArgs GetEventArgs(Type objectType) { string eventName = GetEventName(objectType, StatusEventType.Any); //通一会话中,同一个对象类型的状态事件的参数只有一个,不需要通过事件类型再来划分,因为这样用起来不灵活 string argsName = _getStatusEventArgsName(eventName); return(AppSession.GetOrAddItem <StatusEventArgs>(argsName, () => { return Symbiosis.TryMark <StatusEventArgs>(StatusEventArgs.Pool, () => { return new StatusEventArgs(); }); })); }
private Dictionary <string, object> GetDatasFromAppSession() { return(AppSession.GetOrAddItem(_appSessionDatasKey, () => { var pool = DictionaryPool <string, object> .Instance; return Symbiosis.TryMark <Dictionary <string, object> >(pool, () => { return new Dictionary <string, object>(); }); })); }
private static ValidationError CreateError(string errorCode, string message) { var error = Symbiosis.TryMark(_errorPool, () => { return(new ValidationError()); }); error.ErrorCode = errorCode; error.Message = message; return(error); }
public static DTObject CreateObject(DTEObject root, bool isReadOnly, bool isPinned) { var obj = isPinned ? new DTObject() : Symbiosis.TryMark(_objectPool, () => { return(new DTObject()); }); obj._root = root; obj.IsReadOnly = isReadOnly; obj.IsPinned = isPinned; return(obj); }
public static DTEValue CreateDTEValue(string name, object value, bool isPinned) { var dte = isPinned ? new DTEValue() : Symbiosis.TryMark(_dteValuePool, () => { return(new DTEValue()); }); dte.Init(isPinned); dte.Name = name; dte.Value = value; return(dte); }
private static PropertyValidationError CreatePropertyError(string propertyName, string errorCode, string message) { var error = Symbiosis.TryMark(_propertyErrorPool, () => { return(new PropertyValidationError()); }); error.PropertyName = propertyName; error.ErrorCode = errorCode; error.Message = message; return(error); }
private IEnumerable <T> GetObjectsFromEntries <T>(IQueryBuilder exp, Action <DynamicData> fillArg, QueryLevel level) { var list = Symbiosis.TryMark(ListPool <T> .Instance, () => { return(new List <T>()); }); UseDataEntries(exp, fillArg, (entry) => { var obj = GetObjectFromEntry(entry, level); list.Add((T)obj); }); return(list); }