This project is read-only.

problem using orchard with nhibernate in real world applications!!!

Topics: Administration, Core, Customizing Orchard, General, Troubleshooting, Writing modules
Sep 6, 2015 at 11:34 AM
hi dears ,
I am beginner in Orchard , I 've wrote some modules and have a nice time with learning and using orchard CMS.
As I decided to use orchard core for my application core , and then I understood that some thing goes wrong for my module!!!
let me say , I wrote a crawler to read news from different news agencies and save them in my data base , and got into troubles :
1- I could not use bulk insert for my record that are over 10000 record per crawler service start!
I found that I could use " _orchardServices.TransactionManager.RequireNew();" , but it does not solve my problem in most of the time !

2 - when I ran crawler my select queries to database stopped with time out !!! I thought that maybe nhibernate lock the hole database for each request ! so I altered my database with :


but again time out occurred in my request when crawler reading and inserting data into tables and I want to see some other pages in the same time !

3- orchard uses contentItemRecord and contentPartRecord table for storing data !
I think it's not a good idea when our data record are some thing like news part, I don't know why we should redundant data ?

now my question :
also , I should mentioned that as I saied I'm beginner and maybe these problems are because of my lack of knowledg!

I decided to get rid of nhibernate in orchard and save data in one table! now I need for your advice and guide , is it a good idea or not ?

Is it good idea to use orchard in projects that are working with large amount of data?

I should say that I 've implemented this application in pure using and entity framework and I did not have any of these problem !

Please let me know if there is some resource that I could use to solve my issues or if not , I need for your advice about implementing such application and website !
Sep 8, 2015 at 9:45 PM

Regarding your questions and comments:
  1. Could you tell me what problem you;re seeing exactly? What do you expect to see, and what are you seeing instead? You also mention that you're committing the transaction using TransactionManager.RequireNew. How often are you calling that, and how exactly does this not solve your problem (also please explain what the problem is that you're seeing).
  2. Are you using SQLCE or SQL Server? If using SQL CE, then maybe that explains the lock. Perhaps this is what you;re seeing?
  3. Can you explain what data specifically is redundant?
  4. Why do you want to get rid of NHibernate? If by data you mean the crawled information, then you could save that in one table if you want. Just create your record class and use IRepository<MyRecordType> to work with that table.
Sep 9, 2015 at 8:46 AM
thanks @sfmskywalker because of your reply !

about your question :

crawler is running in background task per 15 minute, it crawls into pages and get new added news and save them in database. when it 's working I get time out for other request from that database.

1- I 'm using Table DataType in sql server with stored procedure to bulk insert into table in pure mvc, so in that case I could save about more than 100,000 record in less than one minute , but in orchard for storing about 1000 record I should wait more than 1 minute , I should mention that I use TransactionManager.RequireNew per 100 records insert or update !

I 'm using SQL Server , so I think that insertion should not lock the whole database as well as one table when I alter database with :

2- in orchard data are stored in ContentPartRecord table for example in my case, NewsPartRecord and in document storage form in ContentItemRecord , is it not redundent?

3- NewsPart contains BlogPostPart , CommonPart , ... and I want to show some news records in some blog post , so I think , I couldn't use record for News or if I could, I don't know any solution for doing so?

4- nhibernate has some limitation on working with stored procedure , views , ... or as I confess in previous post , it 's because of my lack of knowledge in nhibernate!