How can I use "Expression.Not" with text field?
I need to select all records from NHQuestionCount except "ktest"
for example this code return runtime error
NHQuestionCount[] stats = NHQuestionCount.FindAll(Order.Asc("NameFull"), Expression.Not(Expression.Eq("NameFull", "ktest")));
...
I'd like to model the following relationship.
[JoinedBase]
MasterForm{
Guid MasterFormId {get;set;}
/* some base properties like modifiedBy etc... */
}
[ActiveRecord]
TerminationForm{
[PrmaryKey(Foreign)]
Guid MasterFormId {get; set;}
/* Some more properties specific to terminations */
}
[ActiveRecord("TermStaffing")]
...
I have implemented a search function using Castel Active Record. I thought the code is simple enough but I kept getting
NHibernate.QueryParameterException : could not locate named parameter [searchKeyWords]
errors. Can someone tell me what went wrong? Thanks a million.
public List<Seller> GetSellersWithEmail(string searchKeyWords)
...
I have been using the ActiveRecord library for many years. Recently I started a new project and I'm including the AR 2.0 release in this project. I saw that it shipped with the Linq to Nhibernate library. Are there any good examples of how to use Linq to Nhibernate with the Active Record library?
...
I have written an hql to support paging
string hql = @"select distinct mr
from MediaResource as mr
where mr.Deleted= false
and mr.Type = :typeId";
SimpleQuery<MediaResource> q = new SimpleQuery<MediaResource>(hql);
q.Se...
I'd like one of my entities to have a one-to-one relationship with a class hierarchy. Think of it like a Strategy pattern, where each strategy needs different parameters to be persisted. I tried using a combination of OneToOne and JoinedBase/JoinedKey, but I've come across a problem.
With this combination, the primary key of the main en...
I am trying to perform an hql query which returns a list of objects with distinct property value. Following is my pseudo code:
string hql = @"select distinct m from Merchandise m
where m.Serial is unique"
I am using Castle ActiveRecord on top of NHibernate. I have spent half a day on this problem but couldn't find the c...
Has anyone gotten Fluent NHibernate to work with Castle ActiveRecord?
I am particularly interested in Automapping to configure entities for use with the ActiveRecordMediator repository.
...
I have a many-to-many relationship with surrogate key
The classes are: Insurer - InsurerSection - Section.
InsurerSection has one extra attribute: active : bool.
How do I access these bool property? Is it possible to have this property contained within the Insurer and Section objects or do I have to call something like:
InsurerSect...
I'm trying to create a Criteria query to select objects that are related via an association table.
Insurer * - 1 Insurer_Section 1 - * Section
InsurerSection has an association attribute: active:bool.
How do I get all Insurers whose active attribute in the InsurerSection class is set to true?
PS: I can't go like this:
Insurer.FindA...
I am looking into migrate a large project to Entity Framework 4.0 but am not sure if it can handle my inheritance scenario.
I have several projects that inherit from an object in the “main” project. Here is a sample base class:
namespace People
{
public class Person
{
public int age { get; set; }
public String...
I have an hql query
string hql = @"select distinct ba, bp from BstArea as ba, BstPhoneInfo as bp
where bp.CodeSegment like :mobilePhoneNumber
and ba.AreaCode = bp.AreaCode";
Now, I want to create a query to execute this hql and retrieve the result. I tried
SimpleQuery q = new Simpl...
I'm running some unit tests using Castle ActiveRecord that interact with a database. I have a procedure to drop the database (if it exists), then re-create it, before I interact with it in each test.
If I run one test, this works fine.
If I run multiple tests, the second one fails because it can't drop the database.
Is there some way...
Just a quick question about usage of TransactionScope in ActiveRecord. Is this something that is used and works or do people use some other method of handling transactions. I am not familiar, and I am not working with AC but I am thinking about adopting SessionScope and TransactionScope for my project, and was just wondering what people ...
I used a section in my app.settings to configure AR, in which I specified:
<activerecord pluralizeTableNames="true">
Now, I moved to using ActiveRecordIntegration facility and a separate xml file. How can I configure pluralizeTableNames ?
...
I'm working with an object model in Castle ActiveRecord that represents pregnant women. It's a simple tree structure:
Patient
Visit
Delivery
A Patient has 0 or more Visits and a Visit has 0 or more Deliveries. I've mapped everything to the database, and I can loop through the Patient>Visit>Delivery hierarchy and print out ever...
When using Castle ActiveRecord, how would you implement this query:
SELECT vote, COUNT(*) FROM VotesOnQuestions WHERE questionid = x GROUP BY vote
I would like to count all votes on a question, and group this by the vote value.
...
I'm using Active Record with ActiveRecord Facility, and am trying to use a custom NHibernate query. Do I need to define a mapping for a class even though it extends ActiveRecordBase and has ActiveRecord attribute?
[ActiveRecord("VotesOnQuestions")]
public class VoteOnQuestion : ActiveRecordBase<VoteOnQuestion>
{
[CompositeKey]
p...
I'm a complete noob to NHibernate & ActiveRecord.
What would you say is the best way to start using them productively - following the manuals step by step, or progress in small steps by actually using it and cross the problems as I encounter them?
...
I'm using Castle ActiveRecord, but wrapping it in my own persistence layer, because I want to hide this fact from application code. However, my entities all inherit from ActiveRecordBase<T>, so my choice of ORM is leaking to the application. What I especially don't like is the slew of methods this exposes off my entities.
How can I use ...