![]() | CYQ.Data componentsCYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project |
CYQ.Data 数据框架 版本发布 V3.0
Platform for dynamic |
|
|
| #TopicOwner |
前言: 继正式发布V2.0到现在,已30来天了,一直静悄悄的都没发布什么版本
中间仅有插播了一下:CYQ.Data 数据框架 版本发布 V2.5 只因最近花了很多时间在重构一个以前的博客,目前已完成其基础功能,不日将发布相关文章。 提前预览网址:秋色园:http://www.cyqdata.cn/
本次版本升级内容大体说明: 1:Access应用调整 2:修正对:uniqueidentifier、ntext、text、Image等几个类型的应用。 3:扩展缓存类CacheManage方法 4:本次重点,增加CYQ.Data.Xml名称空间,简化xml操作。 其它:内部小调整N多小代码,就略过了......
以下针对更新进说明
一:Access应用调整 1:默认关闭事务:Access一次Open只允许执行一条语句。 2:处理DateTime类型:默认需要转成Date类型才能正确提交。 3:数据库链接字符串处理虚拟目录相对路径: Access配置文件链接可写成: <add name="Conn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}" providerName="System.Data.OleDb"/> <add key="AccessDbNameForWeb" value="myspace.mdb"/>
4:修正自定义视图语句查询语句bug:由于未设置表名,查询之后返回记录总数为0。
二:修正特殊字段类型处理 1:默认uniqueidentifier、ntext、ntext、Image等字段长度为16,在提交时会被截断,本次修正字段初始并对Image类型进行特殊处理。
三:缓存类调整 1:增加Add重载方法,允许传入文件依赖路径及缓存时间 2:增加SetChange、GetHasChanged方法,允许设置及获取缓存对象是否改变。
四:增加CYQ.Data.Xml名称空间,增加5个类 1:抽象基类:XmlBase-》处理加载xml,名称空间处理,DTD处理 2:具体操作类:XmlHelper-》实现对xml具体的增删改查操作,并加入强大的功能,处理MDataRow和MDataTable。 3:DTD解析类:XhtmlUrlResolver-》实现对实体dtd路径的解析 4:多国语言:MutilLanguage-》实现对xml最基本的文本取值。 5:SetType、ValueReplace-》枚举与替换常量
五:XmlHelper 重点语法演示 A:基本语法 ![]() ![]() 1:实例化 XmlHelper helper=new XmlHelper(true); //为ture则表示加载html,默认处理名称空间及解析dtd
2:加载 bool result=helper.Load(Server.MapPath("demo.html")); 3:查询 XmlNode node=helper.GetByID("cyq");//从整个文档取只取id='cyq'的节点。 4:子查询 XmlNode child=Helper.GetByID("cyqchild",node);//从node节点内容中找id='cyqchild'的节点 --其它Get与GetByXX方法类似。 5:列表查询 XmlNodeList nodeList=helper.GetList("div","id","cyq",node);//从node节点内容中找div且id='cyq'的所有节点 --这是最长的重载方法,其它重载方法省略 6:节点赋值 helper.Set(node,SetType.Value,"http://cyq1162.cnblogs.com");//对node的属性value设置值,如果属性不存在则创建。
7:其它方法详见V3.0 API文档
B:与CYQ.Data.Table 共舞,创新SetFor与SetForeach语法 以下示例节选自 重构中的 8国语言版博客 1:实例化与加载略过-》并改实例名helper为Document 2:LoadData(MDataRow) 与SetFor语法,如: ![]() ![]() using(MAction action=new MAction(TableNames.Users)) { if(action.Fill(1)) { Document.LoadData(action.Data); Document.SetFor("labSpaceName");//从action.Data中取SpaceName的值赋给id=labSpaceName的节点的InnerXml属性。 Document.SetFor(IDKey.labSpaceIntro,SetType.value);//从action.Data中取SpaceIntro的值赋给id=labSpaceIntro的节点的value属性。 } }
3:LoadData(MDataTable) 与SetForeach语法,如: 示例1:最原始循环 ![]() ![]() public void FillArticlClass()//文章分类 { MDataTable table; int count; using (MAction action = new MAction(TableNames.Class)) { table = action.Select(0, 0, string.Format("{0}={1} and {2}=0", Class.UserID, DomainID,Class.TypeID), out count); } if (count > 0) { Document.LoadData(table); Document.SetForeach(IDKey.labArticleClass, "<li><a href=\"" + UrlPrefix+ "/article/category/{0}\" >{1}</a> ({2})</li>", Class.ID, Class.Name, Class.Count); } }
示例2:原始循环+对值格式化处理 ![]() ![]() public void FillNewComment()//最新评论 { MDataTable table; int count; using (MAction action = new MAction(TableNames.Comment)) { table = action.Select(1, 10, string.Format("{0}=0 and {1}={2}",Comment.TypeID,Comment.ContentUserID, DomainID), out count); } if (count > 0) { Document.LoadData(table); Document.OnForeach += new XmlHelper.SetForeachEventHandler(Document_OnForeach); Document.SetForeach(IDKey.labNewComment, "<li><a href=\"" + UrlPrefix + "/article/detail/{0}\" >{1}</a></li>", Comment.ContentID, Comment.Body); } } string Document_OnForeach(string text, object[] values, int row) {//对评论长度进行截断 string key = Convert.ToString(values[1]); if (!string.IsNullOrEmpty(key) && key.Length > 12) { values[1] = key.Substring(0, 12); } return text; } 示例3:节点预处理 ![]() ![]() public void FillAllUser()//填充主页所有用户 { using (MAction action = new MAction(TableNames.Users)) { Document.Set(IDKey.labUserName, SetType.A, "{0}[{1}]",Config.HttpHost+"/{1}"); Document.LoadData(action.Select()); Document.SetForeach(IDKey.labAllUser, SetType.InnerXml, Users.NickName, Users.UserName); } }
示例4:节点预处理+格式化 ![]() ![]() private void FillForeachArticle(MDataTable table)//填充循环文章列表 { Document.Set(IDKey.labEdit,SetType.Href,UrlPrefix + "/admin/article/edit/{0}"); Document.Set(IDKey.labDelete, SetType.Href, UrlPrefix + "/admin/article/del/{0}"); Document.Set(IDKey.labTitle, SetType.A, "{1}", UrlPrefix + "/article/detail/{0}"); Document.Set(IDKey.labCreateTime, "{2}"); Document.Set(IDKey.labIsPub, "{3}"); Document.Set(IDKey.labHits, ValueReplace.Source + "({4})"); Document.Set(IDKey.labCommentCount, ValueReplace.Source + "({5})"); Document.LoadData(table); Document.OnForeach += new XmlHelper.SetForeachEventHandler(Document_OnForeach); Document.SetForeach(IDKey.labArticleList,SetType.InnerXml, Content.ID, Content.Title, Content.CreateTime, Content.IsPub, Content.Hits, Content.CommentCount); } string Document_OnForeach(string text, object[] values, int row) { values[3] = Convert.ToString(values[3]) == "1" ? "已发布" : "未发布"; return text; }
六:V3.0 API文档与CYQ.Data.DLL下载
本次版本发布包括: 框架DLL:CYQ.Data.DLL V3.0版本 API文档:V3.0版本 具体下载地址:CYQ.Data 数据框架 下载
结言: 谢谢大伙对本框架喜爱,欢迎大伙下载使用。
![]() |
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.