public override void Initialize(IDatabaseMetaData dbMetaData, IDbms dbms) { if (_metaMap != null) { BeanMetaDataCacheHandler handler = new BeanMetaDataCacheHandler(_metaMap); Type myBeanClass = BeanType; if (handler.IsDBFluteEntity(myBeanClass)) { IBeanMetaData cachedMeta = handler.GetMetaFromCache(myBeanClass); if (cachedMeta == null) { handler.AddMetaFromCache(myBeanClass, this); } } } base.Initialize(dbMetaData, dbms); }
// =============================================================================== // Initialization Override // ======================= public override void Initialize() { _daoInterface = GetDaoInterface(_daoType); _annotationReader = AnnotationReaderFactory.CreateDaoAnnotationReader(_daoType); _beanType = _annotationReader.GetBeanType(); _dbms = GetDbms(_dataSource); // Initialize bean-meta-data! BeanMetaDataCacheHandler handler = new BeanMetaDataCacheHandler(_beanMetaDataCacheMap); _beanMetaData = handler.FindOrCreateCachedMetaIfNeeds(_beanType, _annotationReaderFactory, _dbMetaData, _dbms); if (_beanMetaData == null) { _beanMetaData = new BeanMetaDataCacheExtension(_beanType, _annotationReaderFactory, false);// Don't use cache! } // For lazy initializing methods! // SetupSqlCommand(); }
protected override IBeanMetaData CreateRelationBeanMetaData(PropertyInfo propertyInfo, IDatabaseMetaData dbMetaData, IDbms dbms) { if (_metaMap != null) { BeanMetaDataCacheHandler handler = new BeanMetaDataCacheHandler(_metaMap); IBeanMetaData cachedBmd = handler.FindOrCreateCachedMetaIfNeeds(propertyInfo.PropertyType, AnnotationReaderFactory, dbMetaData, dbms); if (cachedBmd != null) { return(cachedBmd); } } bool isRelation = false; if (this.NestNo > 0) { isRelation = true; } BeanMetaDataCacheExtension bmdExt = new BeanMetaDataCacheExtension(propertyInfo.PropertyType, this.AnnotationReaderFactory, isRelation); bmdExt.NestNo = this.NestNo + 1; bmdExt.Initialize(dbMetaData, dbms); return(bmdExt); }