/// <summary> /// 同一时刻,只有一个对象处理同一文件(IDocument Document,Action completed)中的completed是指当document用完后,需要调用该方法 /// </summary> /// <param name="fileName"></param> /// <returns></returns> public static IDocument Create(string fileName) { lock (_cache) { if (!_cache.TryGetValue(fileName, out var proxy)) { var doc = NewDocument(fileName); if (doc == null) { return(null); //证明不是合法的文档 } proxy = new DocumentProxy(fileName, doc); _cache.Add(fileName, proxy); } proxy.ReferenceTimes++; return(proxy); } }
public virtual void VisitDocumentStart(DocumentProxy document) { }
public virtual void VisitDocumentEnd(DocumentProxy document) { }
/// <summary>Create a instance, wrapping the specified proxy</summary> public DocumentNHibernateImpl(Func<IFrozenContext> lazyCtx, DocumentProxy proxy) : base(lazyCtx, proxy) // pass proxy to parent { this.Proxy = proxy; }
/// <summary>Create a instance, wrapping the specified proxy</summary> public DocumentNHibernateImpl(Func <IFrozenContext> lazyCtx, DocumentProxy proxy) : base(lazyCtx, proxy) // pass proxy to parent { this.Proxy = proxy; }