Geeks With Blogs
Doug.Instance Improving the world one post at a time

What is the Streetlight Store?

The Streetlight Store is a .Net library which uses the Entity Framework and a Microsoft SQL Server database to perform the "back-end" operations required for a typical e-commerce application.  While the Streetlight Store is intended to be used for e-commerce, it is "front-end agnostic" meaning that you could just as easily create a point-of-sale user interface.

Why is there a Streetlight Store?

Why develop another e-commerce solution when there are so many already available? For me the answer comes down to two simple reasons: control and continuity. By "control", I mean of course that I ultimately have control over the source code. Even though this is going to be published as an open-source project, the license and copyright will still be maintained by my company - Streetlight Technologies L.L.C. This allows me to incorporate features to meet my customers' needs while controlling the quality and security of the system. By "continuity", I mean that my customers can have faith that in the event I am unable to continue to support them for any reason, they can continue to receive support from just about any competent developer who can download my source code.

Why is there this Detailed Walk-Through?

I have found that the best way to find problems with your code is to simply try to explain it to someone else.  Over time, I have stopped asking peers to "look at my code" and instead now just say, "You can ignore me.  I am going to talk through my code until I find the problem so you can just go about your business."

How Does it Work?

The Streetlight Store uses a simple object model to send data back and forth to the database.  These objects can be found in the Streetlight.Store.Contracts namespace.  The formatting below is to give you an indicaton of the logical structure and does not necessarily represent the actual object model structure.

  • Product
    • ProductCategory
    • ProductPrice
    • ProductImage
      • ImageFile
    • ProductInventory
  • UserAccount
    • Customer
      • CustomerAddress
      • CustomerPhone
  • ShoppingCart
  • Order
    • OrderItem
  • Shipment

There are other miscellaneous objects, but these represent the "core" of the system.  These classes are NOT Entity Framework model classes.  They are simple, light-weight, POCO ("Plain Old CLR Object") objects.  This is because this system was designed first and foremost for use with web applications.  Web apps are (in spite of some peoples efforts to force them to act otherwise) stateless.  Therefore exposing the Entity Framework objects and their built-in state management can cause some pretty major problems if you don't execute things carefully.

An added benefit of using this "Data Contract" model is that this store can easily be implemented using web services.  In fact, the data contract classes are decorated with the attributes required for WCF services.

These contract objects are stored in and retreived from the database using "Data Manager" classes in the Streetlight.Store.DataAccess namespace:

  • DataManager
    • ProductDataManager
    • AccountDataManager
    • OrderDataManager
    • ShipmentDataManager
The main DataManager class contains instances of the other data managers which then contain references back to the main DataManager class such that any data manager can easily access any other data manager.  Creation and disposal of Entity Framework context instances is controlled by the main DataManager class.
There are some things the Streetlight Store does NOT do by design:
  • Cryptography (encryption/decryption)
  • Credit card processing
  • Shipping calculation

Cryptography is not included for security purposes.  I don't want ANYONE to know the techniques I use to secure sensitive information so publishing them as open-source wouldn't really make much sense.  Credit card processing companies often reqiure non-dislosure agreements for use of their APIs.  This of course prohibits the publishing of a specific implementation as open-source.  Shipping estimation is a very complicated process including many variables: selection of shipping carrier, physical characteristics of products (weight and size), selection of packaging, marketing and promotion (i.e. free shipping), etc.

The following interfaces are provided in the Streetlight.Store namespace to allow developers to implement these functions:

  • ICreditCardProcessor
  • IShippingCalculator
  • ICryptographyProvider
In the following articles, I will walk through the full design including a simple implementation using ASP.Net MVC.
Posted on Saturday, December 31, 2011 9:15 PM | Back to top

Comments on this post: Streetlight Store - Part I: Introducton and Architecture

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Doug Lampe | Powered by: