ошибка
Не удалось скомпилировать документ сопоставления: WebApplication1.documents.hbm.xml
! [альтернативный текст] [1]
фото
http://forum.sources.ru/index.php?act=Attach&type=post&id=2684138&attach_id=1097
web.config
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
<property name="connection.driver_class">
NHibernate.Driver.SqlClientDriver
</property>
<property name="connection.connection_string">
Data Source=MICROSOF-993CA1\SQLEXPRESS;Initial Catalog=DocsContainer;Persist Security Info=True;User ID=sa;Password=123
</property>
<property name="dialect">
NHibernate.Dialect.MsSql2005Dialect
</property>
<property name="show_sql">
false
</property>
</session-factory>
<mapping resource="NHibernate_1.Book.hbm.xml" assembly="NHibernate_1" />
</hibernate-configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Значение параметра compilation debug="true" означает, что в компилированную страницу будут вставлены
отладочные символы. Так как этот
параметр влияет на производительность, следует задавать для него значение True
только на этапе разработки.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
Раздел <authentication> позволяет настроить параметры
режима проверки подлинности, используемого ASP.NET для проверки
подлинности пользователя, запрашивающего разрешение на доступ.
-->
<authentication mode="Forms">
<forms name="ASP_XML_Form" loginUrl="login.aspx" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true"/>
</authentication>
<!--
Раздел <customErrors> позволяет настраивать
параметры действий на случай возникновения необработанных ошибок
во время выполнения запроса. А именно,
он позволяет разработчикам настраивать HTML-страницы
с сообщениями об ошибках, которые будут отображаться вместо трассировки стека ошибок.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!--
Раздел system.webServer требуется для работы ASP.NET AJAX в
Internet Information Services 7.0. Он не требуется для более ранней версии IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
documents.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" namespace="WebApplication1" assembly="WebApplication1">
<class name="WebApplication1.documents" table="documents" lazy="false">
<id name="id" access="field">
<generator class="native" />
</id>
<property name="name" access="field" column="name"/>
<property name="date" access="field" column="date"/>
<property name="author" access="field" column="author"/>
<property name="doclink" access="field" column="doclink"/>
</class>
</hibernate-mapping>
documents.cs
using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using NHibernate;
using System.Security.Principal;
using NHibernate.Cfg;
namespace WebApplication1
{
public class documents
{
public int id;
public string name;
public DateTime date;
public string doclink;
public documents manager;
public void CreateDocuments()
{
documents exSample = new documents();
exSample.name = "never";
using (ISession session = OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
session.Save(exSample);
transaction.Commit();
}
//Response.Write("saved exSample to the databases");
}
}
public ISessionFactory factory;
public ISession OpenSession()
{
if (factory == null)
{
Configuration conf = new Configuration();
conf.AddAssembly(Assembly.GetCallingAssembly());
factory = conf.BuildSessionFactory();
}
return factory.OpenSession();
}
}
}
использовать
Documents doc = новые документы ();
doc.CreateDocuments ();
в
doc.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication1
{
public partial class docs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Request.IsAuthenticated)
{
Response.Redirect("login.aspx");
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
/* String rootPath = Server.MapPath("docs\\");
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(rootPath + FileUpload1.FileName);
Response.Write("file save in " + rootPath+FileUpload1.FileName + " size of file " + FileUpload1.FileBytes.Length.ToString());
}
*/
documents doc = new documents();
doc.CreateDocuments();
}
}
}
дата базы
CREATE TABLE documents(
id int identity PRIMARY KEY,
name nvarchar(50),
date datetime,
author nvarchar(50),
doclink nvarchar(50)
)
NHibernate.MappingException не
обработано пользовательским кодом
Сообщение = "Не удалось скомпилировать отображение
документ:
WebApplication1.documents.hbm.xml "
Source = "NHibernate" StackTrace:
в NHibernate.Cfg.Configuration.LogAndThrow (Исключение
исключение)
в NHibernate.Cfg.Configuration.AddValidatedDocument (NamedXmlDocument
док)
в NHibernate.Cfg.Configuration.ProcessMappingsQueue ()
в NHibernate.Cfg.Configuration.AddDocumentThroughQueue (NamedXmlDocument
документ)
в NHibernate.Cfg.Configuration.AddXmlReader (XmlReader
hbmReader, строковое имя)
в NHibernate.Cfg.Configuration.AddInputStream (Stream
xmlInputStream, String name)
в NHibernate.Cfg.Configuration.AddResource (String
дорожка, сборка в сборе)
в NHibernate.Cfg.Configuration.AddAssembly (сборка
монтаж)
в WebApplication1.documents.OpenSession ()
в D: \ Документы и настройки \ Admin \ Мои
документы \ Visual Studio
2008 \ Projects \ WebApplication1 \ WebApplication1 \ documents.cs: строка
51
в WebApplication1.documents.CreateDocuments ()
в D: \ Документы и настройки \ Admin \ Мои
документы \ Visual Studio
2008 \ Projects \ WebApplication1 \ WebApplication1 \ documents.cs: строка
33
в WebApplication1.docs.Button1_Click (Object
отправитель, EventArgs e) в D: \ Documents
и настройки \ Admin \ Мои
документы \ Visual Studio
2008 \ Projects \ WebApplication1 \ WebApplication1 \ docs.aspx.cs: строка
43
в System.Web.UI.WebControls.Button.OnClick (EventArgs
е)
в System.Web.UI.WebControls.Button.RaisePostBackEvent (String
eventArgument)
в System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (String
eventArgument)
в System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler
sourceControl, String eventArgument)
в System.Web.UI.Page.RaisePostBackEvent (NameValueCollection
PostData)
в System.Web.UI.Page.ProcessRequestMain (Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
InnerException:
NHibernate.MappingException
Сообщение = "Проблема при попытке установить тип свойства с помощью отражения"
Источник = "NHibernate"
Трассировки стека:
в NHibernate.Mapping.SimpleValue.SetTypeUsingReflection (String
className, String propertyName, String
accesorName)
в NHibernate.Cfg.XmlHbmBinding.ClassBinder.CreateProperty (IValue
value, String propertyName, String
className, подузел XmlNode,
IDictionary 2 inheritedMetas)
в NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML(XmlNode
node, PersistentClass model,
IDictionary
2 унаследованных Метас,
UniqueKey uniqueKey, логический изменяемый,
Булево значение, обнуляемое, логическое значение NaturalId)
в NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML (XmlNode
узел, модель PersistentClass,
IDictionary 2 inheritedMetas)
в NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode
node, HbmClass classSchema,
IDictionary
2 унаследованных Метас)
в NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses (XmlNode
parentNode, IDictionary`2
inheritedMetas)
в NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind (XmlNode
узел)
в NHibernate.Cfg.Configuration.AddValidatedDocument (NamedXmlDocument
док)
InnerException: NHibernate.MappingException
Сообщение = "класс WebApplication1.documents,
WebApplication1, версия = 1.0.0.0,
Культура = нейтральная, PublicKeyToken = ноль
не найден при поиске недвижимости:
автор»
Источник = "NHibernate"
Трассировки стека:
в NHibernate.Util.ReflectHelper.ReflectedPropertyClass (String className, String name, String accessorName) в NHibernate.Mapping.SimpleValue.SetTypeUsingReflection (String className, String propertyName, String accesorName) InnerException: NHibernate.'"Source =" NHibernate "PropertyName =" author "StackTrace: в NHibernate.Properties.FieldAccessor.GetField (тип, строковое поле fieldName, тип originalType) в NHibernate.Properties.FieldAccessor.GetField (тип шрифта, строковое полеName, тип originalType)в NHibernate.Properties.FieldAccessor.GetField (тип Тип, строковое поле fieldName) в NHibernate.Properties.FieldAccessor.GetGetter (тип theClass, свойство String propertyName) в NHibernate.Util.ReflectHelper.GetGetter (введите свойство Class, String, свойствоName, String) в StringA.Util.ReflectHelper.ReflectedPropertyClass (String className, String name, String accessorName) InnerException: