Good morning, guys.
I'm with a problem with the query that NHibernate generates. My mapping is like bellow:
public class Matricula
{
[BelongsTo("IdTurma", NotNull=True)]
public Turma {get;set;}
}
public class Turma
{
[BelongsTo("IdCurso", NotNull=True)]
public Curso {get;set;}
}
public class Curso
{
...
Does Castle ActiveRecord's ActiveRecordMediator<> class support LINQ queries? I couldn't find any method that returns an IQueryable<>. My domain objects can't inherit from ActiveRecordLinqBase<> due to their design.
...
I have a TrackLog that has a collection of TrackPoints:
public class TrackLog
{
public string Name { get; set; }
public ISet<TrackPoint> TrackPoints { get; set; }
}
public class TrackPoint
{
public DateTime Timestamp { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
}
I'd lik...
How can I write a criteria to return all Orders that belong to a specific User?
public class User
{
[PrimaryKey]
public virtual int Id { get; set; }
}
public class Order
{
[PrimaryKey]
public virtual int Id { get; set; }
[BelongsTo("UserId")]
public virtual User User { get; set; }
}
return ActiveRecordMediator<Order>.Fin...
I have primary key sequence for oracle in my Castle ActiveRecord class:
[PrimaryKey(PrimaryKeyType.SeqHiLo, "UserId", SequenceName = "users_seq")]
public int Id { get; set; }
Now i need to configure ActiveRecord to use Sql Server, but it does not support sequences, but it's not possible, since oracle-specific mapping is used.
I don't...
I have a Store and a Product entity:
public class Store
{
public Guid Id { get; set; }
public int Version { get; set; }
public ISet<Product> Products { get; set; }
}
public class Product
{
public Guid Id { get; set; }
public int Version { get; set; }
public Store ParentStore { get; set; }
public string Nam...
I have a Store that contains a list of Products:
var store = new Store();
store.Products.Add(new Product{ Id = 1, Name = "Apples" };
store.Products.Add(new Product{ Id = 2, Name = "Oranges" };
Database.Save(store);
Now, I want to edit one of the Products, but with a transient entity. This will be, for example, data from a web browser...
I have a versioned entity, and this is what happens when I use SaveOrUpdate() vs. SaveOrUpdateCopy():
// create new entity
var entity = new Entity{ Id = Guid.Empty });
Console.WriteLine(entity.Version); // prints out 0
// save the new entity
GetNewSession();
entity.SaveOrUpdate();
Console.WriteLine(entity.Version); // prints out 1
Get...
Can Castle ActiveRecord do optimistic locking on properties? I found optimistic locking for the entire class, but not for an individual property. In my case, I need to make it so that adding/removing elements in a collection does not update the version number of the entity (so for example, adding a Product to a Store without changing any...
Hi all, I've just started playing with Castle active record as it seems like a gentle way into NHibernate. I really like the idea of the database schema being generate from my classes during development.
I want to do something similar to the following:
[ActiveRecord]
public class Camera : ActiveRecordBase<Camera>
{
[PrimaryKey]
...
When you run into a reserved word like "User" in NHibernate you would just put single quotes around the offending text and nHibernate will surround the text with square brackets for querying. My question is how do you do the same thing using Castle.ActiveRecord?
...
Is it possible to use generic support with single table inheritance, and still be able to FindAll of the base class?
As a bonus question, will I be able to use ActiveRecordLinqBase<> as well? I do love those queries.
More detail:
Say I have the following classes defined:
public interface ICompany
{
int ID { get; set; }
string...
Hi *,
I've got a problem with an multi-threaded desktop application using Castle ActiveRecord in C#:
To keep the GUI alive while searching for the objects based on userinput I'm using the BackgroundWorker for the search-function. Some of the properties of the objects, especially some HasMany-Relations, are marked as Lazy.
Now, when th...
I am using Castle ActiveRecord as my ORM. When I try to store unicode strings, I get question marks instead.
Saving unicode strings worked perfectly when I was using mysql, but when I recently switch to SQL Server it broke. How should I go about fixing this?
...
Given the following code for our Active Record Entites and ValueTypes Linq is not working for us.
[ActiveRecord("Person")]
public class PersonEntity : ActiveRecordLinqBase<PersonEntity>
{
string _name;
[Property("Name", Length = 20, ColumnType = "string",
Access = PropertyAccess.FieldCamelcaseUnderscore)]
public Name Name
...
This query works fine:
DetachedCriteria filter = DetachedCriteria
.For(typeof(NotificationRecord), "nr")
.Add(Expression.Eq("nr.Submission.Id", 5));
return ActiveRecordMediator<NotificationRecord>.FindAll(filter);
This query fails with the exception message: could not resolve proper...
Hello Guys!
I have a Question class in ActiveRecord with following fields:
[ActiveRecord("`Question`")]
public class Question : ObcykaniDb<Question> {
private long id;
private IList<Question> relatedQuestions;
[PrimaryKey("`Id`")]
private long Id {
get { return this.id; }
set { this.id = value; }
}...
Hey all,
I'm new to MonoRail and ActiveRecord and have inherited an application that I need to modify. I have a Category table (Id, Name) and I'm adding a ParentId FK which references the Id in the same table so that you can have parent/child category relationships.
I tried adding this to my Category model class:
[Property]
public...
Hey,
In MonoRail/Active Record if I want to grab all records that have a certain column equal to null, I can do:
public static Category[] AllParentCategories()
{
return (FindAllByProperty("Parent.Id", null));
}
However, what if I want to grab all records where that column doesn't equal null? I can't figure...
Can I do this?
I have the following in my code:
public class ARClass : ActiveRecordBase<ARClass>
{
---SNIP---
public void DoStuff()
{
using (new SessionScope())
{
holder.CreateSession(typeof(ARClass)).Lock(this, LockMode.None);
...Do some work...
}
}
}
So, as I'm sure ...