异常详细信息: IBatisNet.Common.Exceptions.ConfigurationException: Unable to load embedded resource from as

feifeiyaqi3 2009-04-12 08:16:52
异常详细信息: IBatisNet.Common.Exceptions.ConfigurationException: Unable to load embedded resource from assembly "DG_URCM.Model.Maps.News.xml, DG_URCM.Model".


1. 源错误:


行 36: public static T Load<T>()
行 37: {
行 38: return GetContainer().Resolve<T>();
行 39: }
行 40:


源文件: D:\GDGL\DG_URCM.Web\1\ServiceLoader.cs 行: 38
[ConfigurationException: Unable to load embedded resource from assembly "DG_URCM.Model.Maps.News.xml, DG_URCM.Model".]
IBatisNet.Common.Utilities.Resources.GetEmbeddedResourceAsXmlDocument(String resource) +707
IBatisNet.Common.Utilities.Resources.GetAsXmlDocument(XmlNode node, NameValueCollection properties) +329
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap() +706
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize() +5078
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao) +345




2. source code: servicesload.cs


public static T Load<T>()
{
return GetContainer().Resolve<T>();
}

3. news.xml code:

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="News">

<alias>
<typeAlias alias="News" type="DG_URCM.Model.News, DG_URCM.Model" />
</alias>

<resultMaps>
<resultMap id="News_Result" class="News">
<result property="NewsId" column="NewsId" />
<result property="Title" column="Title" />
<result property="Content" column="Content" />
<result property="Author" column="Author" />
<result property="AddTime" column="AddTime" />
<result property="UserId" column="UserId" />
</resultMap>
</resultMaps>

<cacheModels>
<cacheModel id="News_Cache" implementation="LRU">
<flushInterval hours="120"/>
<flushOnExecute statement="InsertNews"/>
<flushOnExecute statement="UpdateNews"/>
<flushOnExecute statement="DeleteNews"/>
<property name="CacheSize" value="20"/>
</cacheModel>
</cacheModels>

<statements>
<select id="FindNews" parameterClass="String" resultMap="News_Result" cacheModel="News_Cache">
SELECT * FROM [TB_News] WHERE NewsId = #value#
</select>
<insert id="InsertNews" parameterClass="News">
INSERT INTO [TB_News] ([NewsId], [Title], [Content], [Author], [AddTime], [UserId])
VALUES (dbo.fn_CreateNewsId(), #Title#, #Content#, #Author#, #AddTime#, #UserId#)
</insert>
<update id="UpdateNews" parameterClass="News">
UPDATE [TB_News] SET [Title] = #Title#, [Content] = #Content#, [Author] = #Author#, [AddTime] = #AddTime#, [UserId] = #UserId#
WHERE [NewsId] = #NewsId#
</update>
<delete id="DeleteNews" parameterClass="String">
DELETE FROM [TB_News] WHERE [NewsId] = #value#
</delete>
<select id="FindAllNews" parameterClass="map" resultMap="News_Result" cacheModel="News_Cache">
SELECT * FROM [TB_News]
<dynamic prepend="Where">
<isNotEmpty property="Title" prepend="And">
Title Like '%$Title$%'
</isNotEmpty>
<isNotEmpty property="AddTime" prepend="And">
AddTime = #AddTime#
</isNotEmpty>
<isNotEmpty property="Year" prepend="And">
DATEPART(year, AddTime) = #Year#
</isNotEmpty>
</dynamic>
Order By AddTime Desc
</select>
<select id="GetNewsCount" parameterClass="map" resultClass="int">
SELECT Count(*) FROM [TB_News]
<dynamic prepend="Where">
<isNotEmpty property="Title" prepend="And">
Title Like '%$Title$%'
</isNotEmpty>
<isNotEmpty property="AddTime" prepend="And">
AddTime = #AddTime#
</isNotEmpty>
<isNotEmpty property="Year" prepend="And">
DATEPART(year, AddTime) = #Year#
</isNotEmpty>
</dynamic>
</select>





<select id="FindNewsByTime" parameterClass="map" resultMap="News_Result" cacheModel="News_Cache">
SELECT * FROM [TB_News]
<dynamic prepend="Where">
<isNotEmpty property="AddTime" prepend="And">
datediff(dd,#AddTime#,addtime)=0
</isNotEmpty>


</dynamic>


</select>



<select id="FindNewsByKeyWord" parameterClass="map" resultMap="News_Result" cacheModel="News_Cache">
SELECT * FROM [TB_News]
<dynamic prepend="Where">
<isNotEmpty property="Title" prepend="And">
Title Like '%$Title$%'
</isNotEmpty>
</dynamic>
</select>



<select id="FindNewsByTimeAndKeyword" parameterClass="map" resultMap="News_Result" cacheModel="News_Cache">
SELECT * FROM [TB_News]
<dynamic prepend="Where">
<isNotEmpty property="AddTime" prepend="And">
datediff(dd,#AddTime#,addtime)=0
</isNotEmpty>
<isNotEmpty property="Title" prepend="And">
Title like '%$Title$%'
</isNotEmpty>
</dynamic>
</select>





</statements>
</sqlMap>

thank you

yaqi

...全文
709 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaohaolin 2010-09-04
  • 打赏
  • 举报
回复
fadsfasd
forestml2008 2009-05-18
  • 打赏
  • 举报
回复
将xml配置文件设置为"嵌入的资源"即可
feifeiyaqi3 2009-04-14
  • 打赏
  • 举报
回复
marks

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧