public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
public class Book { private long id; private string isbn; private string title; public virtual long ID { get { return id; } protected set { id = value ; } } public virtual string ISBN { get { return isbn; } set { isbn = value ; } } public virtual string Title { get { return title; } set { title = value ; } } public Book() { } public Book( string bookIsbn, string bookTitle) { isbn = bookIsbn; title = bookTitle; } } * This source code was highlighted with Source Code Highlighter .
When writing or editing the mapping manually, I don’t want to refer to the reference book every time to recall the necessary attribute or element. VS and xsd-schemes for configuration and mapping of files will help us in this. They are in the previously downloaded archive. These are nhibernate-configuration-2.0.xsd, nhibernate-mapping-2.0.xsd, and nhibernate-generic.xsd. Copy them to the [Path To Microsoft Visual Studio Folder] \ Xml \ Schemas folder and restart the studio. Everything, you can use Intellisense when creating mapping-files. |
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="utf-8" ? > < hibernate-mapping xmlns ="urn:nhibernate-mapping-2.2" namespace ="NHibernate_1" assembly ="NHibernate_1" > < class name ="Book" table ="Books" > < id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id > < property name ="ISBN" /> < property name ="Title" /> </ class > </ hibernate-mapping > * This source code was highlighted with Source Code Highlighter .
< class name ="Book" table ="Books" >
< id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id >
< id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id >
< id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id >
< id name ="ID" unsaved-value ="0" > < column name ="ID" not-null ="true" /> < generator class ="identity" /> </ id >
- < property name = "ISBN" />
- < property name = "Title" />
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
<? xml version ='1.0' encoding ='utf-8' ? > < hibernate-configuration > < session-factory xmlns ="urn:nhibernate-configuration-2.2" > < property name ="connection.provider" > NHibernate.Connection.DriverConnectionProvider </ property > < property name ="connection.driver_class" > NHibernate.Driver.SqlClientDriver </ property > < property name ="dialect" > NHibernate.Dialect.MsSql2005Dialect </ property > < property name ="connection.connection_string" > Server=DevDB;Initial Catalog=NHibTut;Trusted_Connection=yes; </ property > < mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" /> </ session-factory > </ hibernate-configuration > * This source code was highlighted with Source Code Highlighter .
< session-factory xmlns ="urn:nhibernate-configuration-2.2" >
Here I want to make a small clarification. Since you often have to work on different computers, in order not to constantly change the connection string to the database, you can create an alias for your database. Thus, you no longer need to worry about the connection string from wherever you work. |
< mapping resource ="NHibernate_1.Book.hbm.xml" assembly ="NHibernate_1" />
ISessionFactory sessionFactory = new Configuration().Configure( "Nhibernate.cfg.xml" ).BuildSessionFactory();
Unit of Work contains a list of objects, tracks their changes, and then writes changes to the database. UnitofWork tracks all changes, as it is the only way to access the database. Objects that are not placed in UnitOfWork will not be written to the database, i.e. When using this template, you can not access the database directly. The algorithm of working with the Unit of Work in general is as follows: 1. The object is read from the database and is registered in the Unit of Work list. Immediately after reading from the database, the object is marked as “clean”, i.e. Dirty = false; 2. When modified or created, the object is marked as Dirty = true 3. When deleting as Deleted 4. To record changes to the database, Commit is called. |
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
private static ISession GetSession( bool getNewIfNotExists) { ISession currentSession; if ( HttpContext .Current != null ) { HttpContext context = HttpContext .Current; currentSession = context.Items[sessionKey] as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); context.Items[sessionKey] = currentSession; } } else { currentSession = CallContext.GetData(sessionKey) as ISession; if (currentSession == null && getNewIfNotExists) { currentSession = sessionFactory.OpenSession(); CallContext.SetData(sessionKey, currentSession); } } return currentSession; } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
class Program { static void Main() { // Domain.Init(); // Book long bookId; // ISession session = Domain.CurrentSession; // ITransaction tr = session.BeginTransaction(); // Book Book book = new Book( "NW8523IDISDN" , "How to learn not to do stupid things v.1" ); // session.Save(book); // bookId = book.ID; // . // , tr.Commit(); session.Flush(); // , , , session.Clear(); // Book book1 = session.Get<Book>(bookId); // , if (book == book1) { Console .WriteLine( "Yep!!!" ); } // . Domain.Close(); Console .ReadKey(); } } * This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/37984/
All Articles