????????????Rookey.Frame?????????????????????д???????????????????????????mssqlserver???????????????????в??????δ???????????????????????????????????????????????????????????????????????????????μ?web.config???????????Rookey.Frame.WebConfigmodelConfig.xml????web.config??????????????????£?
<connectionStrings>
<addname="DbReadConnString"connectionString="DataSource=.;InitialCatalog=Rookey_Frame;UserID=sa;Password=123456;
Pooling=true;MAXPoolSize=512;MinPoolSize=50;ConnectionLifetime=30"providerName="System.Data.SqlClient"/>
</connectionStrings>
????web.config?????????????????????????????????name?DbReadConnString?????????????name?DbWriteConnString???д?????
??????modelConfig.xml?????????£?
<?xmlversion="1.0"encoding="utf-8"?>
<Root>
<BaseLogEntityisEnableCache="0"cacheType="0"dbType="MsSqlServer"readConnString="DataSource=.;InitialCatalog=Rookey_Log;
UserID=sa;Password=123456;Pooling=true;MAXPoolSize=512;MinPoolSize=50;ConnectionLifetime=30"></BaseLogEntity>
<!--???????????????-->
<BaseSysEntityisEnableCache="1"cacheType="0"></BaseSysEntity>
</Root>
????????BaseLogEntity??BaseSysEntity?????????????????????????????????????????????????????????????DataSource=.;InitialCatalog=Rookey_Log;UserID=sa;Password=123456;Pooling=true;MAXPoolSize=512;MinPoolSize=50;
ConnectionLifetime=30???????????????????????????????BaseLogEntity??BaseSysEntity????????????????????????????????????????????????????????????????????????е??????鶼???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Rookey.Frame.DALFactoryOrmLiteDalFactory.cs?????и??????????????????????
///<summary>
///????????????
///</summary>
///<paramname="connString">??????????????</param>
///<paramname="read">????</param>
///<returns></returns>
privatestringGetConnString(stringconnString??boolread=true)
{
stringlastConnStr=!string.IsNullOrEmpty(connString)?connString:(read?this.ReadConnectionString:this.WriteConnectionString);
stringmodelConfigConnString=GetModelConfigConnString(read);//??????????????????????
if(string.IsNullOrEmpty(connString)&&!string.IsNullOrEmpty(modelConfigConnString))
{
lastConnStr=modelConfigConnString;
}
NotNullCheck.NotEmpty(lastConnStr??"??????????????");
returnlastConnStr;
}
///<summary>
///???????????????
///</summary>
///<paramname="modelType">??????????</param>
///<paramname="dbType">?????????</param>
///<paramname="read">??д???????????????????????д?????</param>
///<returns></returns>
publicstaticstringGetModelConnString(TypemodelType??outstringdbType??boolread=true)
{
dbType=string.Empty;
stringmodelConfigPath=GetModelConfigXml();
stringnode=string.Format("/Root/{0}"??modelType.Name);
boolnodeIsExists=XmlHelper.NodeIsExists(modelConfigPath??node);
if(!nodeIsExists)//??????????????????????????????????????
{
//???????
TypebaseType=modelType.BaseType;
if(baseType!=null)//???????
{
node=string.Format("/Root/{0}"??baseType.Name);//??????
nodeIsExists=XmlHelper.NodeIsExists(modelConfigPath??node);
}
}
if(!nodeIsExists)returnstring.Empty;
stringtempConnStr=XmlHelper.Read(modelConfigPath??node??read?"readConnString":"writeConnString");
if(!read&&string.IsNullOrEmpty(tempConnStr))
{
tempConnStr=XmlHelper.Read(modelConfigPath??node??"readConnString");
}
dbType=XmlHelper.Read(modelConfigPath??node??"dbType");
returntempConnStr;
}
????????isEnableCache?????????????????1?????????????????????????????棬cacheType??????????????????
///<summary>
///????????
///</summary>
publicenumCacheProviderType
{
///<summary>
///???????
///</summary>
LOCALMEMORYCACHE=0??
///<summary>
///MemcachedCache????????
///</summary>
MEMCACHEDCACHE=1??
///<summary>
///redis????????
///</summary>
REDIS=2
}
?????????????????????????????????????????


???????????????????Memcached??Redis???????????????????Rookey.Frame.WebConfig?μ?memcachedcache.config??rediscache.config
????memcachedcache.config??
<?xmlversion="1.0"?>
<MemcachedCacheConfigInfoxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ServerList>
<string>127.0.0.1:11211</string>
</ServerList>
<MinPoolSize>10</MinPoolSize>
<MaxPoolSize>20</MaxPoolSize>
<ConnectionTimeOut>10</ConnectionTimeOut>
<QueueTimeOut>10</QueueTimeOut>
<ReceiveTimeOut>10</ReceiveTimeOut>
<DeadTimeOut>100</DeadTimeOut>
<CacheTimeOut>3600</CacheTimeOut>
</MemcachedCacheConfigInfo>
rediscache.config??
<?xmlversion="1.0"encoding="utf-8"?>
<RedisConfigInfoxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Host>127.0.0.1</Host>
<Port>6379</Port>
<Pwd></Pwd>
<InitalDB>0</InitalDB>
</RedisConfigInfo>
??????????????????????????????????????????????????