Umbraco 数据结构
1.sa 用户是个特殊的用户 不可以分配‘creatoradmin权限’。解决办法,新建个用户 就可以分配了。
2. 数据库基本表 , 不包含 cms 内容的表:
3.xml数据的作用,
执行sql:
select umbracoNode.id, umbracoNode.parentId, umbracoNode.level, umbracoNode.sortOrder, cmsPreviewXml.xml from umbracoNode
inner join cmsPreviewXml on cmsPreviewXml.nodeId = umbracoNode.id
where trashed = 0
order by level,sortOrder
表 cmsPreviewXml 不能小看这些xml数据他们可是 一个对象 对应一个 完成的 功能块的数据源。
再看下 ~/App_Data/umbraco.config这些数据 仔细一看还真让人兴奋,这不是发不出来的每一个页面数据吗?
4. 说了数据库 之外 umbraco 怎么与众 不同之处,persentation 中的一些代码 制作了 context/ page的类,同时在底层都同数据交流做很好的结合,可以说是把 微软框架结合的很好的一个项目。
5.数据库 怎么连接:
umbraco.business 下 GlobalSettings .cs中包含有读取web.config的对应的
///
/// Gets the database connection string
///
/// The database connection string.
public static string DbDSN
{
get
{
try
{
return ConfigurationManager.AppSettings["umbracoDbDSN"];
}
catch
{
return String.Empty;
}
}
set
{
if (DbDSN != value)
{
SaveSetting("umbracoDbDSN", value);
}
}
}
这样就拿到了数据库连接字符串:
在 umbraco.cms中 这个恰好就是数据库交互的一层:
namespace umbraco.BusinessLogic
{
///
/// Class for handling all registered applications in Umbraco.
///
public class Application
{
......................................
private static ISqlHelper _sqlHelper;
......................................
。。。。。。。。。。。
///
/// Gets the SQL helper.
///
/// The SQL helper.
public static ISqlHelper SqlHelper
{
get
{
if (_sqlHelper == null)
{
try
{
_sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
}
catch { }
}
return _sqlHelper;
}
}
。。。。。。。。。
}
}
而在 数据库交互的时候 :
在 umbraco.cms中 体现的有:
namespace umbraco.cms.businesslogic
{
///
/// CMSNode class serves as the base class for many of the other components in the cms.businesslogic.xx namespaces.
/// Providing the basic hierarchical data structure and properties Text (name), Creator, Createdate, updatedate etc.
/// which are shared by most umbraco objects.
///
/// The child classes are required to implement an identifier (Guid) which is used as the objecttype identifier, for
/// distinguishing the different types of CMSNodes (ex. Documents/Medias/Stylesheets/documenttypes and so forth).
///
public class CMSNode : BusinessLogic.console.IconI
{
。。。。。。。。。。。。。。。。。。
///
/// Gets the SQL helper.
///
/// The SQL helper.
protected static ISqlHelper SqlHelper
{
get { return Application.SqlHelper; }
}
。。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。。。。。。
///
/// Retrieve a list of the node id's of all CMSNodes given the objecttype
///
/// The objecttype identifier
///
/// A list of all node ids which each are associated to a CMSNode
///
public static int[] getAllUniqueNodeIdsFromObjectType(Guid objectType)
{
IRecordsReader dr = SqlHelper.ExecuteReader("Select id from umbracoNode where nodeObjectType = @type",
SqlHelper.CreateParameter("@type", objectType));
System.Collections.ArrayList tmp = new System.Collections.ArrayList();
while (dr.Read()) tmp.Add(dr.GetInt("id"));
dr.Close();
return (int[])tmp.ToArray(typeof(int));
}
。。。。。。。。。。。。。。。。。。。。。。
}
}
waitting...
now I installing the project .