Mindscape
  • Register
  • Login
  • YOUR CART IS EMPTY
home
Software
  • Developers Toolbox
  • LightSpeed
  • Raygun
  • WPF Elements
  • Web Workbench
  • Metro Elements
  • Silverlight Elements
  • NHibernate Designer
  • Phone Elements
  • WPF Diagrams
  • Simple DB management
  • Visual Tools for SharePoint
Downloads
Store
  • Buy online
  • Purchase order
  • Volume discounts
  • Reseller
  • Software license
  • Contact sales
Blog
Support
About
  • About Us
  • Contact
  • Testimonials
rss
twitter
facebook
Implementing Storage Policies with LightSpeed Entity Tracking Soft Deletion Timestamps for Entity Tracking and Soft Deletion User Ids for Entity Tracking and Soft Deletion Concurrent Editing Implementing Policies in HandCoded Entities Change Tracking

Implementing Policies in HandCoded Entities

As indicated above, LightSpeed’s storage policies are implemented using specially named fields.  In fact, storage policies are determined by the presence of these specially named fields.  In hand‑coded entities, therefore, you can implement a storage policy just by declaring a field with the appropriate name.

Implementing time tracking in a hand-coded entity

public class Document : Entity<int>
{
  // "Field is never assigned to" - LightSpeed assigns these fields internally #pragma warning disable 649
  private readonly DateTime _createdOn;
  private readonly DateTime _updatedOn;
  #pragma warning restore 649
  public DateTime CreatedOn { get { return _createdOn; } }
  public DateTime UpdatedOn { get { return _updatedOn; } }
}

Special fields should normally be marked readonly as they should be modified only by LightSpeed, not by application code.  This will cause a compiler warning because there is no way to set the fields: you should disable this warning as shown above.  ASP.NET medium trust environments do not allow LightSpeed to modify readonly fields: if you plan to use your model in such an environment, implement the special fields as read‑write.

Column Names for Policy Fields

The LightSpeed fields for storage policies must have the names listed above.  If you need to use different column names in the database, you can map them using ColumnAttribute or LightSpeedContext.NamingStrategy.  This option is only available when hand-coding entities.

Data Products

  • LightSpeed ORM
  • NHibernate Designer
  • SimpleDB Tools
  • SharePoint Tools

DevOp Tools

  • Raygun

Visual Controls

  • WPF Elements
  • WPF Diagrams
  • Silverlight Elements
  • Phone Elements

Popular Products

  • Web Workbench

    Modern web development for Visual Studio!

  • Mindscape Megapack

    All Mindscape products for one awesome price!

Quick Links

  • Forums
  • Blog
  • Register
  • Login
  • Contact us
  • Twitter
  • Facebook
  • Google+
  • YouTube
  • Linkedin
  • Rss

© Mindscape 2025. Mindscape is a registered trademark of Mindscape Limited.

  • Terms
  • Privacy