void wu_Finish(DbWorkUnit unit) { unit.Start -= wu_Start; unit.Finish -= wu_Finish; if (unit.Type == DbWorkUnitType.Write) { if (unit.Session.Transaction.IsActive) { unit.Session.Transaction.Commit(); } } var sess = unit.Session; if (sess.IsOpen) { try { sess.Flush(); } catch (Exception ex) { log.Debug(ex); } } sess.Dispose(); }
void wu_Start(DbWorkUnit unit) { unit.Session.FlushMode = FlushMode.Auto; if (unit.Type == DbWorkUnitType.Write) { unit.Session.Transaction.Begin(); } }
public override IList ActionCommand() { IList rawLookup; using (DbWorkUnit wu = GetSessionFor(DbWorkUnitType.Write)) { var query = wu.Session.CreateQuery(Query); return(query.List()); } }
void wu_Finish(DbWorkUnit unit) { unit.Start -= wu_Start; unit.Finish -= wu_Finish; if (unit.Type == DbWorkUnitType.Write) { if (unit.Session.Transaction.IsActive) { unit.Session.Transaction.Commit(); } } unit.Session.Flush(); }
private ICriteria CreateGetByRelatedCriteria(DbWorkUnit wu, IClassifiable classifiable, RelationDirection direction = RelationDirection.Undefined, TaxonEntity type = null) { var criteria = wu.Session.CreateCriteria <RelationEntity>() .Add(Restrictions.Eq("RelatedObjectName", classifiable.ObjectName)) .Add(Restrictions.Eq("RelatedObjectID", classifiable.Id)); if (type != null) { criteria.Add(Restrictions.Eq("Type", type)); } if (direction != RelationDirection.Undefined) { criteria.Add(Restrictions.Eq("Direction", (int)direction)); } return(criteria); }
public override object ActionCommand() { throw new NotImplementedException("This part is not implemented, as a simgle solution moved to domain module"); //FindByValue<T>(string metricsName, decimal value, DateTime at) //select t.* from metricsentry as t //join (select y.metrics_id, max(y.recorddate) as d from metricsentry as y //where metrics_id in (select id from metrics where name = 'AlexaTopFile') //and y.recorddate<=634586400000000000 //group by metrics_id) as yy //on t.metrics_id = yy.metrics_id and yy.d = t.recorddate //where t.value>10 using (DbWorkUnit wu = GetSessionFor(DbWorkUnitType.Write)) { return(wu.Session.CreateCriteria(typeof(MetricsEntity)).List()); } }