I have one database and two application, one is web ant the other is
desktop.
I have an assembly that contains my data and business objects and this is
referenced to both those projects.
While both of them are running:
- when an object is added from webb app, this is got by win app but the
problem occurs after this object updated in web app. I get this object in a
collection by ICriteria. When I refresh this object I get the latest version
but I do not want to refresh all objects in the collection.
My Crriteria is:
public IList<TickerText> GetByDelStatus(DelStatus delStatus, int
pageNumber, int pagerSize)
{
ICriteria criteria = CreateCriteria();
criteria.Add(Restrictions.Eq(TickerTextPropertyNames.DelStatus.ToString(),
(int)delStatus));
SetPaqing(criteria, pagerSize, pageNumber);
criteria.AddOrder(Order.Desc(TickerTextPropertyNames.CreateDate.ToString()));
criteria.SetCacheable(false);
return criteria.List<TickerText>();
}
My SessinFactory Properties:
NHibernate.Cfg.Configuration cfg = new
NHibernate.Cfg.Configuration();
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider,
"NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString,
connectionString);
cfg.SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass,
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle");
cfg.SetProperty(NHibernate.Cfg.Environment.CacheProvider,
"NHibernate.Cache.NoCacheProvider, NHibernate");
cfg.SetProperty(NHibernate.Cfg.Environment.UseQueryCache,
"false");
cfg.SetProperty(NHibernate.Cfg.Environment.UseSecondLevelCache,
"false");
if (IsInWeb())
cfg.SetProperty(NHibernate.Cfg.Environment.CurrentSessionContextClass,
"NHibernate.Context.ManagedWebSessionContext, NHibernate");
else
cfg.SetProperty(NHibernate.Cfg.Environment.CurrentSessionContextClass,
"NHibernate.Context.CallSessionContext, NHibernate");
cfg.SetProperty(NHibernate.Cfg.Environment.Dialect,
"NHibernate.Dialect.MsSql2005Dialect");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver,
"NHibernate.Driver.SqlClientDriver");
cfg.AddAssembly(assemblyName);
Thanks.
On Sun, Oct 18, 2009 at 12:22 AM, YankeeImperialistDog <
[email protected]> wrote:
>
> I'm creating, or trying to create a DTO for a Person class
> ******
> namespace KurtStack.Data.Repositories
> {
> public static class PersonDTO
> {
> public static object GetPersonDTO()
> {
> var session =
> IoC.Container.Resolve<INHibernateSessionProvider>() as ISession;
> var obj = session.CreateCriteria(typeof(Person))
> .CreateAlias("FirstName", "fn")
> .CreateAlias("LastName", "ln");
> return obj;
> }
> }
> }
> ***
> my problem is getting this to return to my UI via a Command object
> with out directly referencing INHibernateSessionProvider. Any ideas on
> how to do this?
>
> my command object does not directly reference KurtStack.Data.
>
> so to get it to the UI i'd like to do something like this:
> GetPersonDTO. ... hrlp
>
> public class NewPersonCommand : ICommand
> {
> private readonly Person person;
>
> public static object GetPersonDTO()
> {
> object obj = GetpersonDTO();
> return obj;
> }
>
> >
>
--
Hasan Uzun
+905377755511
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---