会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Windows Workflow Foundation
WXWinter —— 兰竹菊梅★春夏秋冬☆ —— wxwinter@163.com
订阅
管理
随笔 - 332
文章 - 5
评论 - 3534
阅读 -
176万
Tracking_自定义Profile筛选(2)
将
Pofile
对象的
XML
串存入数据库
该方法 调用了
Tacking
数据库的默认存储过程
UpdateTrackingProfile
,也可用自已的方式直接对
Tacking
数据库操作
private
static
void
插入Profile的XML串到数据库(
string
XML字串, Version 版本)
{
string
sql
=
@"
Initial Catalog=Tracking;Data Source=WXWINTER\SQLEXPRESS;Integrated Security=SSPI;
"
;
//
调用存储过程UpdateTrackingProfile
SqlCommand command
=
new
SqlCommand();
command.CommandType
=
CommandType.StoredProcedure;
//
类型是存储过程
command.CommandText
=
"
dbo.UpdateTrackingProfile
"
;
//
操作 的存储过程
command.Connection
=
new
SqlConnection(sql);
//
数据库连接字串
try
{
//
字段---------------------------------------------
SqlParameter typeFullName
=
new
SqlParameter();
typeFullName.ParameterName
=
"
@TypeFullName
"
;
typeFullName.SqlDbType
=
SqlDbType.NVarChar;
//
值为要设置工作流类的类名 : typeof(wxdlzm1).ToString()
typeFullName.SqlValue
=
typeof
(wxdlzm_wxwinter).ToString();
command.Parameters.Add(typeFullName);
//
字段----------------------------------------------------
SqlParameter assemblyFullName
=
new
SqlParameter();
assemblyFullName.ParameterName
=
"
@AssemblyFullName
"
;
assemblyFullName.SqlDbType
=
SqlDbType.NVarChar;
//
值为要设置工作流类的全称名 : typeof(wxdlzm1).Assembly.FullName
assemblyFullName.SqlValue
=
typeof
(wxdlzm_wxwinter).Assembly.FullName;
command.Parameters.Add(assemblyFullName);
//
TrackingProfile表Version字段--------------------------------
SqlParameter versionId
=
new
SqlParameter();
versionId.ParameterName
=
"
@Version
"
;
versionId.SqlDbType
=
SqlDbType.VarChar;
//
值为要指定的片本号的字串:格式"3.0.0.7"
versionId.SqlValue
=
版本.ToString();
command.Parameters.Add(versionId);
//
TrackingProfile表TrackingProfileXml字段-----------------------
SqlParameter trackingProfile
=
new
SqlParameter();
trackingProfile.ParameterName
=
"
@TrackingProfileXml
"
;
trackingProfile.SqlDbType
=
SqlDbType.NVarChar;
//
值为TrackingProfile格式的XML字串
trackingProfile.SqlValue
=
XML字串;
command.Parameters.Add(trackingProfile);
//
-----------------------------------------------------------
command.Connection.Open();
//
打开连接
command.ExecuteNonQuery();
//
执行
Console.WriteLine();
Console.WriteLine(
"
已将Profile插入
"
);
Console.WriteLine();
}
catch
(SqlException e)
{
Console.WriteLine();
Console.WriteLine(
"
插入Profile方法的Try捕获:插入数据出错了:
"
);
Console.WriteLine(e.Message);
Console.WriteLine();
command.Dispose();
return
;
}
finally
{
if
((
null
!=
command)
&&
(
null
!=
command.Connection)
&&
(ConnectionState.Closed
!=
command.Connection.State))
{
command.Connection.Close();
}
}
command.Dispose();
}
查询自定义
Pofile
的版本
该方法 调用了
Tacking
数据库的默认存储过程
GetTrackingProfile
,也可用自已的方式直接对
Tacking
数据库操作
private
static
Version 得到Profile版本()
{
//
调用存储过程GetTrackingProfile
string
sql
=
@"
Initial Catalog=Tracking;Data Source=WXWINTER\SQLEXPRESS;Integrated Security=SSPI;
"
;
TrackingProfile profile
=
null
;
SqlDataReader SQL读取对象
=
null
;
SqlCommand command
=
new
SqlCommand();
command.CommandType
=
CommandType.StoredProcedure;
//
类型是存储过程
command.CommandText
=
"
dbo.GetTrackingProfile
"
;
//
操作的存储过程
command.Connection
=
new
SqlConnection(sql);
//
数据库连接字串
try
{
//
字段
SqlParameter typeFullName
=
new
SqlParameter();
typeFullName.ParameterName
=
"
@TypeFullName
"
;
typeFullName.SqlDbType
=
SqlDbType.NVarChar;
//
值为要查询的工作流类的类名: typeof(wxdlzm1).ToString() 或typeof(wxdlzm1).FullName
typeFullName.SqlValue
=
typeof
(wxdlzm_Wxwinter).FullName;
//
command.Parameters.Add(typeFullName);
//
字段
SqlParameter assemblyFullName
=
new
SqlParameter();
assemblyFullName.ParameterName
=
"
@AssemblyFullName
"
;
assemblyFullName.SqlDbType
=
SqlDbType.NVarChar;
//
值为要查询工作流类的全称名: typeof(wxdlzm1).Assembly.FullName
assemblyFullName.SqlValue
=
typeof
(wxdlzm_Wxwinter).Assembly.FullName;
command.Parameters.Add(assemblyFullName);
//
SqlParameter versionId
=
new
SqlParameter();
versionId.ParameterName
=
"
@Version
"
;
versionId.SqlDbType
=
SqlDbType.VarChar;
command.Parameters.Add(versionId);
//
SqlParameter createDefault
=
new
SqlParameter();
createDefault.ParameterName
=
"
@CreateDefault
"
;
createDefault.SqlDbType
=
SqlDbType.Bit;
createDefault.SqlValue
=
0
;
command.Parameters.Add(createDefault);
command.Connection.Open();
SQL读取对象
=
command.ExecuteReader();
if
(SQL读取对象.Read())
{
string
profile的Xml字串
=
SQL读取对象[
0
]
as
string
;
if
(
null
!=
profile的Xml字串)
{
TrackingProfileSerializer 串行化对象
=
new
TrackingProfileSerializer();
StringReader stringReader对象
=
null
;
try
{
stringReader对象
=
new
StringReader(profile的Xml字串);
profile
=
串行化对象.Deserialize(stringReader对象);
}
finally
{
if
(stringReader对象
!=
null
)
stringReader对象.Close();
}
}
}
}
//
--------以上得到从数据库中得到profile的Xml字串,并将其返串为TrackingProfile对象
finally
{
if
((SQL读取对象
!=
null
)
&&
(
!
SQL读取对象.IsClosed))
SQL读取对象.Close();
if
((command
!=
null
)
&&
(command.Connection
!=
null
)
&&
(ConnectionState.Closed
!=
command.Connection.State))
{
command.Connection.Close();
}
command.Dispose();
}
//
----------------------------------
if
(profile
!=
null
)
{
return
new
Version(profile.Version.ToString());
}
else
{
//
如果数据库中没有,就返回"0.0.0.0"格式,表示没有,此为自定义约定
return
new
Version(
"
0.0.0.0
"
);
}
}
分类:
WF3.0 技术文章
好文要顶
关注我
收藏该文
微信分享
WXWinter(冬)
粉丝 -
697
关注 -
0
推荐博客
+加关注
0
0
升级成为会员
«
上一篇:
Tracking_自定义Profile筛选(1)
»
下一篇:
关于工作流的模式
posted @
2006-09-25 19:31
WXWinter(冬)
阅读(
1272
) 评论(
1
)
编辑
收藏
举报
刷新页面
返回顶部
登录后才能查看或发表评论,立即
登录
或者
逛逛
博客园首页
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
编辑推荐:
·
10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
·
.NET Core 中如何实现缓存的预热?
·
从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
·
AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
·
基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
·
TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
·
阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
·
【译】Visual Studio 中新的强大生产力特性
·
10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
·
【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
随笔分类
(316)
BPM.Foundation 平台(2)
Wxwinter.WF 平台(5)
工作流开发中用到的技术(23)
工作流开发中用到的算法(9)
工作流设计思想(59)
工作流与图形图象(12)
流程设计器(17)
WF 例子(23)
WF3.0 技术文章(78)
WF3.5 技术文章(5)
WF4.0 Beta1 技术文章(17)
WF4.0 技术文章(40)
Wxwinter.BPM平台(6)
春夏秋冬(11)
企业信息化建设(9)
点击右上角即可分享
AI IDE Trae
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构