PetShop项目学习笔记(一)

PetShop项目学习

数据库结构

工厂方法模式

页面缓存

缓存了页面中的一些变量

文件缓存依赖

消息队列

ORM了解

————2012-3-12-16:40:51————

今天才真正看了PetShop的代码,感觉好复杂啊!微软用ADO.net实现了类似于ORM的机制。

首先PetShop在Oracle中的数据表如下,包括4个解决方案:

PetShop项目学习笔记(一)_第1张图片

程序集描述:

Model定义用到的对象类

DBUnitility数据库操作,看了OracleHelper abstract类,主要包括五个静态的连接字符串:

View Code
 public static readonly string ConnectionStringLocalTransaction = ConfigurationManager.ConnectionStrings["OraConnString1"].ConnectionString;
public static readonly string ConnectionStringInventoryDistributedTransaction = ConfigurationManager.ConnectionStrings["OraConnString2"].ConnectionString;
public static readonly string ConnectionStringOrderDistributedTransaction = ConfigurationManager.ConnectionStrings["OraConnString3"].ConnectionString;
public static readonly string ConnectionStringProfile = ConfigurationManager.ConnectionStrings["OraProfileConnString"].ConnectionString;
public static readonly string ConnectionStringMembership = ConfigurationManager.ConnectionStrings["OraMembershipConnString"].ConnectionString;

不过奇怪的是在Web.config文件中连接字符标签都没有,可以看到的只有下面的东西!RSAProtectedConfigurationProvider是什么啊?

一查,原来是提供使用 RSA 加密对配置数据进行加密和解密的,提供了一种方法以加密存储在配置文件中的敏感信息,这有助于防止对这些信息进行未经授权的访问。(参考:http://msdn.microsoft.com/zh-cn/library/system.configuration.rsaprotectedconfigurationprovider(VS.80).aspx

View Code
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>xV/ayWV3paJMvcGPXixX8ylWquj9ercwS2+2ZyfT4QbxqefHI5e8k7z/7W7cp+Fi9LjrEkdDulLq2tTDyQQlmquj65ue2DwiGCAG4qVgm8wZheJu08YAYEj8aq1oJNU/iebj7MJX0WDSr5NLW6+U1uofmuW5XurZdL/btGU+I+8=</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>/Ymdh2iAQa/l5KBu50IErP2JZ3faeGfZT7V4ZARKmVf9lFEoQEHEeAiZWoxkSSvrmlQY9MZLdL0ow5QY3msl+DEqV2hWn+S4iPEXnlgUkqKMlEEhJ2lGUo/lFdMoUSQZoRQnOOYXId40b7Sq2Ypb1pQ+16EvJJV1YtmCcfb1cd+B3OBIxTTzfQQ+220sPaAxDlx9zfWeZ5mWf+jLqOHEMDxEmCfA5VapTEuXpxtefHyqhl8r449Fgcf8Uvynwtlq9ndCCSJfNCwKvHoORcikdxwh0OSlEVFAIQKMiou8NwPOKttUrkjQOwPuAfER8FySdVrmZKqdokGtoSio1DhG4qGS06kvad/aOJDTlof94U47LYIe1OapERcGq7n09LcJ91BhDOf6EcMbPAVpw8bjhf5lQCiqWasL5WpLEifx22YDE5y21zVMc34OH7vvXNvzkds6TUBb3ZPggphndd5fD38b/3vs7AYczltUxBGBCmYIWPlx/69ImpUz5jidgaflgQuv1ESB0VD+8yIqqex1H9bsLgBsrg9WhLMkOvK5M5fdOoIYc7UCGNPx5U8EJ1B6ZYKynIMw8O/Z+v+Z4hArNbiE4+5txfmtolJ0vcPfOS46kRZNRO7zCFr2BkabAh8m1mcOTn86QUt+8cEJHYPPNCxZCgD0P+pcJ313+Nph+azkGa3W1+xuV2ZnnMYgGRO1MJycezc9Mpk0rPzGnadyxZNmqDvMHwmNaoBFyl8jpFhECn7NgkB+KQ3HocbAhinQafpX6TnSV/uqPWD/QrSAcvJ6gz2QyubO0CH7qVZsUdGWe1LnjOL5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yiBH8XgSBD6vWzeJsK7xw4XLabjwHxT5sqkhiEKnMjyVWrxvbQDyGL7wspYUBHyoA==</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>

从程序的入口Default.aspx进入,分析代码,先看NavigationControl代码,

View Code
 private void BindCategories() {
Category category = new Category();
repCategories.DataSource = category.GetCategories();
repCategories.DataBind();
}

沿着这一条路走下来,可以理解一些东西了!


 

你可能感兴趣的:(学习笔记)