deepload的递归指的是什么, 何时用deepload的递归?
让我举个例子来说明这些问题吧
以下我们以node来举例
数据结构
id是主键, pid是外键
生成后并使用deepload, deepload的参数说明可以看第一篇文章
Node node = DeepLoadById(1, false, DeepLoadType.IncludeChildren, typeof(Node), typeof(TList<Node>));
此时我们可以使用
node.PidSource 类型为Node
node.NodeCollection 类型为TList<Node>
node.NodeCollection[0] 类型为Node
分别表示父节点,和子节点集合
那么我们要取父节点的父节点该如何取呢?
聪明的宁一定想到了 node.PidSource.PidSource
可为什么取出来是null呢?
因为我们没有使用递归
我们将代码改为
Node node = DeepLoadById(1, true, DeepLoadType.IncludeChildren, typeof(Node), typeof(TList<Node>));
好了, 这样便完成了 对id==1 的node 的读取, 并且读取出所有的父节点(递归)及子节点(递归)
关于日志:
nettiers使用了 Microsoft.Practices.EnterpriseLibrary.Logging
使用起来很方便
Logger.Write(obj);
就可以写入日志了, 关于Logging Application Block 的配置, 大家可以搜一下cnblogs以前的文章, 有很多介绍
关于异常:
nettiers使用了Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
使用起来同样很方便...
ExceptionPolicy.HandleException(exceptionToHandle, policyName)
配置都在entlib.config中
发一个entlib.config

Code
<configuration>
<configSections>
<!--microsoft-->
<section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<securityConfiguration defaultAuthorizationInstance="NetTiers.RuleProvider"
defaultSecurityCacheInstance="">
<authorizationProviders>
<!--microsoft-->
<add type="Microsoft.Practices.EnterpriseLibrary.Security.AuthorizationRuleProvider, Microsoft.Practices.EnterpriseLibrary.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="NetTiers.RuleProvider" />
</authorizationProviders>
<securityCacheProviders>
<!--petshop-->
<add cacheManagerInstanceName="Stars.CMS.Entities.EntityCache" defaultSlidingSessionExpirationInMinutes="10" defaultAbsoluteSessionExpirationInMinutes="60" type="Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.CachingStoreProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Caching Store Provider" />
<!--SerialNumber-->
<add cacheManagerInstanceName="Stars.SerialNumber.Entities.EntityCache" defaultSlidingSessionExpirationInMinutes="10" defaultAbsoluteSessionExpirationInMinutes="60" type="Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.CachingStoreProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Caching Store Provider" />
<!--Rbac-->
<add cacheManagerInstanceName="Stars.Rbac.Entities.EntityCache" defaultSlidingSessionExpirationInMinutes="10" defaultAbsoluteSessionExpirationInMinutes="60" type="Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.CachingStoreProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Caching Store Provider" />
</securityCacheProviders>
</securityConfiguration>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add databaseInstanceName="DBLogging" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory"
formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Database Trace Listener" />
<add fileName="Logs\log.exclude" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
rollFileExistsBehavior="Overwrite" rollInterval="Day" formatter=""
header="----------------------------------------" footer="----------------------------------------"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="DateTime" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Rolling Flat File Trace Listener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="Error" name="Exceptions">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="General">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<exceptionHandling>
<exceptionPolicies>
<add name="StarsPolicy">
<exceptionTypes>
<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow" name="Exception">
<exceptionHandlers>
<add logCategory="Exceptions" eventId="100" severity="Error"
title="Stars Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.XmlExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Logging Handler" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
<cachingConfiguration >
<cacheManagers>
<!--pet shop-->
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="Null Storage"
name="Stars.CMS.Entities.EntityCache" />
<!--SerialNumber-->
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="Null Storage"
name="Stars.SerialNumber.Entities.EntityCache" />
<!--Rbac-->
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="Null Storage"
name="Stars.Rbac.Entities.EntityCache" />
</cacheManagers>
<backingStores>
<!--microsoft-->
<add encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Null Storage" />
</backingStores>
</cachingConfiguration>
<connectionStrings>
<!--logging connection string-->
<add name="DBLogging" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Logging;Integrated Security=True;Connect Timeout=30;" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
摘要: NetTiers 生成完毕后,默认会在Service层使用logging
但是在默认情况下,被捕获的异常没有被抛出,
下面是通过修改entlib.config, 实现 rethrow.
阅读全文
摘要: 最近一直在解决RADGrid与NetTiers及JQuery兼容,整合的问题
今天好不容易把RADGrid绑定,排序,分页的问题解决了,并且可以设置默认排序了...
阅读全文
摘要: 扩展1个属性 ContractPersonName , 这个属性需要Deepload Users表 才能得到
所以加了判断,如果没有DeepLoad则会抛出异常
建一个实体数据源和一个GridView,允许DeepLoad但不允许递归,不允许事务,允许分页和排序,使用GetPaged方法进行查询
DeepLoad Users对象,再添加5个参数,4个输入,1个输出,PageIndex,OrderBy和PageSize都取GridView的属性
最后再添加一个过滤的参数...
到底是网页绑定好还是后台绑定好,也要看具体的情况而定~
如果太复杂...还是后台吧...
阅读全文
摘要: 介绍了 SqlFilterBuilder 和 ParameterizedSqlFilterBuilder 的使用方法和区别
public void Test()
{
SqlFilterBuilder
filter = new SqlFilterBuilder(); //test SqlFilterBuilder
//ParameterizedSqlFilterBuilder filter = new ParameterizedSqlFilterBuilder(); //test ParameterizedSqlFilterBuilder
filter.Junction = SqlUtil.AND;
filter.Append(ContractColum阅读全文
摘要: Table View Proc 查询 简单查询 支持 支持 手动实现 多表关联查询 DeepLoad 效率较低,编码较复杂 支持 优点:效率较高,编码简单,能够使用聚合函数缺点:实现较为复杂,难以维护 手动实现 与View类似 分页查询 支持 支持 手动实现缺点:分页需要手动实现 插入 插入 支持 不支持 手动实现 事务 支持 不支持 手动实现 比较 优点:对事物支持 更新 更新 支持 不支持 手...
阅读全文
摘要: 1. 设置自定义存储过程的前缀 {0}==表名, {1}==存储过程前缀(可有可无),
我这里是ups_{0}_ == usp_表名_方法名
2.建立存储过程,名称为usp_tblUsers_GetByUserName
3.GetByUserName方法将出现在UsersProvider下
到这一步就完成了,值得注意的是,存储过程的写法有一定讲究
关键是那个as, 一定要顶格...前面不能有东西...为了这个...我白白浪费了1个小时....
btw, 如果存储过程的返回类型,不是预期的类型(如:表,int等),则返回模板中选择的类型 DataSet 或iDataReader
也可以通过以下方法访问
DataRepository.Provider.ExecuteDataSet();
DataRepository.Provider.ExecuteNonQuery();
DataRepository.Provider.ExecuteReader();
阅读全文
摘要: Drools.NET v3.0 Copyright 2007 Sahi Technologies Pvt. Ltd. (http://www.esahi.com)
Contacts: Ritu Jain (ritujain@esahi.com), Chinmay Nagarkar (chinmay.nagarkar@esahi.com)
The Drools.NET-3.0 is a .NET version of Jboss-Rules 3.0, which is a Rules Engine implementation based on Charles Forgy's Rete algorithm tailored for the Java language. Drools.NET enables .NET developers/Users to exploit a powerful Rule Engine like Jboss-Rules through a completely managed .NET code base.
阅读全文
摘要: CCNet 1.3 release
Integration Queues
The biggest feature change to CCNet 1.3 is the addition of Integration Queues to control and manage integration concurrency. Integration queues allow you to control which projects are permitted to build concurrently and to set their relative priorities. Please read the documentation for more information.
.NET 2.0 Migration
CCNet has now been ported to the .NET 2.0 platform. This means that the .NET 2.0 Redistributable package will need to
阅读全文
摘要: IDE:Visual Studio 2005 + Resharper.3.0
语言:Asp.net ,C#
单元测试:NUnit
网页测试:VSTS
框架及代码生成:.netTiers v2.1.0.560
日志:entLib 3.1
web控件:Telerik.Rad.Controls
代码管理:SVN
bug追踪:TrackStudio
数据库:Sql 2k
ER: ER-Win
每日构建:ccNet
网页开发:母版页配合主题文件
javascript:暂定jquery+prototype
权限:RBAC
未解决:
每日构建中添加性能测试
流程引擎或规则引擎
针对不同客户的个性化需求
skin的切换
NetTiers配置界面
将文件加入SVN
可以查看下SVN中的版本
引用R.A.D的DLL
阅读全文
摘要: 模板增加1. 是否自动增加版本号2. EnterpriseLibrary的版本 (v2 or v3)3.包含创建日期 (在cs文件的头部)4. DropStyle (Entity or all ) drop已存在的存储过程,选择entity的话,drop当前实体的存储过程 ,选择all的话 ,drop 满足[存储过程前缀]但不满足[自定义存储过程前缀]的存储过程......看不懂的话,还是看说明吧...
阅读全文