This afternoon I’m developing a web application, while I’m buildind the site I did a refresh on a page….after some seconds this is the result showed from firefox
Amazing.
Alk.
In the preceding post I showed you a simple class that store in database string or integer values, now I need to create a criteria to do searches in database. NHibernate Criteria API are really good and they are extendible, to create a new criteria simply create a class that inherits from AbstractCriterion. I need [...]
Continue reading about Writing a Custom Criteria in Nhibernate
I have a simple class in my domain to solve a particular problem, it must be able to store the value of a generic parameter, so it can contains actually everything. Without Domain Model and ORM the obvious solution can be a serialization in a ntext or a xml field in sql2005, but I really [...]
Continue reading about The simpliest thing that could possibly work.
When it’s time to validate the user input on an asp.net page the validators control come to the rescue. If you want to do some custom validation that is not supported by the standard validator controls that ship with asp.net 2.0 you can resort to use asp:CustomValidator. Let’s do a little example on how to [...]
Continue reading about Asp.NET 2.0 CustomValidator and Client script validation
Suppose you have created some classes to access customer table in northwind database, a good mapping could be the following.
<?xml version=“1.0“ encoding=“utf-8“ ?><hibernate-mapping xmlns=“urn:nhibernate-mapping-2.2“ namespace=“Nablasoft.NhibernateGen.Domain.Entities“ assembly=“Nablasoft.NhibernateGen.Domain“> <class name=“Customer“ table=“Customers“ lazy=“true“ > <id name=“Id“ column=“CustomerId“> <generator class=“identity“ /> </id> <component name=“AddressInfo“> <property name=“Address“ /> <property name=“City“ /> <property name=“Region“ /> <property name=“PostalCode“ /> <property name=“Country“ /> </component> <component name=“ContactInfo“> <property name=“ContactName“/> <property name=“ContactTitle“/> </component> <property name=“CompanyName“/> <property name=“FaxNumber“ column=“Fax“ /> <property name=“PhoneNumber“ column=“Phone“/> </class></hibernate-mapping>
Undoubtedly this mapping works well, but what happens when you use SchemaExport class to recreate the schema of the database from the mapping? The answer is that the table that gets created is not so appealing.
create table dbo.Customers ( CustomerId NVARCHAR(255) IDENTITY NOT NULL, Address NVARCHAR(255) null, City NVARCHAR(255) null, Region NVARCHAR(255) null, PostalCode NVARCHAR(255) null, Country NVARCHAR(255) null, ContactName NVARCHAR(255) null, ContactTitle NVARCHAR(255) null, CompanyName NVARCHAR(255) null, Fax NVARCHAR(255) null, Phone NVARCHAR(255) null, primary key (CustomerId))
As [...]
Continue reading about Importance of good mappings in nhibernate




