Sometimes you would want to explicitly set dead lock priority as part of a transaction which is not possible if you are using NHibernate as of now. In such cases you can define a custom Interceptor which does the trick. Here is a small snippet of code that can help you achieve that:
public class DeadLockPriorityInterceptor : EmptyInterceptor
{
private ISession session;
private string priority;
public DeadLockPriorityInterceptor(string...
public string aboutme {
var known = { { "C#" , "Javascript" }, { "ASP.NET", "MVC" } };
return known.ToJson();
}
Friday, 26 April 2013
Wednesday, 24 April 2013
CompositeId() throws exception - Could not compile the mapping document: (XmlDocument)
After defining a map for composite key
CompositeId()
.KeyProperty(x => x.title)
.KeyProperty(x => x.label);
The following exception is raised when trying to create a composite key
CreateSessionFactory() - Inner exception: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
..
CreateSessionFactory()...
Saturday, 13 April 2013
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
Have encountered with an sql error after running following sql:
INSERT INTO [Member](FirstName, LastName, CreationDate, LastActivityDate)
VALUES ('Saif', 'Ikram' , '13/04/2013 22:15:44', '01/01/1753 00:00:00')
go
"The conversion of a varchar data type to a datetime data type resulted in an out-of-range value". Actually there is nothing wrong with sql. Now run following sql to see if this works
set language british
go
INSERT...
Labels:
NHibernate,
SQL Server
Thursday, 4 April 2013
Consuming return value from stored procedure using NHibernate without mapping
After haggling around I have found a solution that works. First I have created a stored procedure as follows:
CREATE PROCEDURE GETTOTALINCOME
AS
DECLARE
@TOTALINCOMECOUNT MONEY;
BEGIN
SELECT @TOTALINCOMECOUNT = SUM(INVAMOUNT) FROM INVOICE
RETURN @TOTALINCOMECOUNT;
END;
This is a simple stored procedure that just returns a value. Now lets look at NHibernate code block that can execute the stored procedure and...
Subscribe to:
Posts (Atom)