I've created a Wcf service using a MySQL database and Castle ActiveRecord.
The service will be called individually a number of times from different
3rd Party applications. I'm wanting the Wcf service to cache all frequently
used data, rather than making repeated trips to the database.
I've set the Wcf service to run as a single
protected void Application_Start(object sender, EventArgs e){
IConfigurationSource oSource = ActiveRecordSectionHandler.Instance
ActiveRecordStarter.Initialize(oSource, typeof(MyObject));}
Then in one my Wcf methods, I have the following to retrieve the data from
the ORM
using (new SessionScope()){
List<MyObject> oObjectList = MyObject.FindAll().ToList();}
My object is set as follows;
[ActiveRecord(Lazy = true)]public class MyObject : ActiveRecordBase<MyObject >{
[PrimaryKey]
public virtual int Id { get; protected set; }
[Property]
public virtual string Name { get; set; }
}
The problem I have, is when doing a simple read to request the data like
MyObject.FindAll().ToList()
, the database is being queried every time, rather than the cached data
being returned, since the data in database is unchanged.
Where am I going wrong...?
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/groups/opt_out.