Language: C#
Example Presenter (ViewModel) showing db4o interactions
using System.Collections.Generic; using System.Linq; using Caliburn.PresentationFramework.ApplicationModel; using CWS.Application.Rounds.Model; using Db4objects.Db4o; namespace CWS.Application.Rounds.Presenters { public class SectionPresenter : Presenter, ISectionPresenter { private readonly IObjectContainer _objectContainer; private IList<EquipmentData> _equipmentData; public Sheet CurrentSheet { get; set; } public Section CurrentSection { get; set; } public SectionPresenter(IObjectContainer objectContainer) { _objectContainer = objectContainer; } protected override void OnInitialize() { base.OnInitialize(); _equipmentData = _objectContainer.Query<EquipmentData>( x => x.Equipment.Section == CurrentSection && x.Sheet == CurrentSheet).OrderBy(x => x.Equipment.Order).ToList(); } protected override void OnShutdown() { var sectionEquipmentData = from ed in CurrentSheet.EquipmentData where ed.Equipment.Section == CurrentSection select ed; sectionEquipmentData.Run(x => _objectContainer.Store(x)); _objectContainer.Store(CurrentSheet); base.OnShutdown(); } public IList<EquipmentData> EquipmentData { get { return _equipmentData; } } } }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

