Sunday, January 25, 2009
NOTE: THIS IS THE READ ME FROM OUR NEW WCF DEMO INCLUDED IN THE ES2009 RELEASE CANDIDATE
 
Welcome to the

EntitySpaces 2009 Q1 WCF Demo

Created by Jon Davis for EntitySpaces, LLC

Contents

Introduction

This sample solution includes a set of projects that illustrate the use of EntitySpaces with Windows Communication Foundation (WCF), which is a technology featureset that arrived when Microsoft .NET 3.0 was released.

This demo is based on .NET 3.5 / Visual Studio 2008. It does not delve into WCF education or theory; it is only a "getting started" sample application that demonstrates how EntitySpaces objects can be used in a WCF architecture.

This is a lightweight sample that does not demonstrate more complex scenarios, such as working with data objects with one-to-many relationships.

Quick Start

This section is provided for those who just want to get the demo up and running and don't want to delve into the details.

To run the demo:

  1. Check the References of each project. If any of the EntitySpaces assembly references are broken (i.e. showing the "missing" icon), you will need to re-reference them. They should be in:
       %ProgramFiles%\EntitySpaces 2009\Runtimes\.NET 3.5\
  2. Make sure SQL Server Express is installed locally, and that you are a SQL Server admin. If the server is not running as ".\SQLExpress" you need to edit the app.config file in the ES2009WCF_Server project and rebuild the solution after reviewing #1 (above).
  3. In Visual Studio's Solution Explorer, right-click on the project called ES2009WCF_Server and choose Set as StartUp Project.
  4. Start Debugging. If you don't run into any errors and all is well, go ahead and shut it down (hit ENTER and let it quit).
  5. In Windows Explorer, track down the server's EXE file. It should be something like %DEMO%\ES2009WCF_Server\bin\Debug\ES2009WCF_Server.exe. Run it.
  6. In Visual Studio, for each of the client projects (each of the projects that are suffixed with "Client"), expand "Service References and right-click on the service reference item (should be something like "ESDemoService") and choose Update Service Reference.
  7. Stop the server process you started two steps previously (hit ENTER and let it shut down).
  8. Choose one of the client projects (any project suffixed with "Client") that you would like to run, right-click it, and select "Set as StartUp Project".
  9. Rebuild Solution.
  10. Start Debugging. The demo server will start automatically (after a prompt).

Troubleshooting:

  1. If with any client project you get an exception saying something followed by ".. The client and service bindings may be mismatched," stop the debugger, keep the server running, and right-click the service reference item in the project (in Solution Explorer) and choose Update Service Reference.
  2. If after the server starts successfully you get a System.ServiceModel.EndpointNotFoundException with a message "Could not connect to http://localhost:8731/ESDemoService/Light/. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8731," you will need to temporarily disable Windows Firewall or poke a hole on port 8731 and/or on behalf of all EXE's involved.
  3. Be sure to restart the demo server's .EXE (or just kill it and let the demo client start it) as it may get locked in a Faulted state if an exception occurrs.

To create WCF projects:

  1. With EntitySpaces DLLs referenced on the client:
    • You will be using the Full / Heavy Proxies on both client and server. These are included with EntitySpaces' Master template.
    • You should use a shared library to be used on both client and server containing your generated business objects.
    • WCF will automatically serialize/deserialize and bind to your EntitySpaces-based library.
    • You will be able to use the Query object using manual binary serialization. (You cannot use XML serialization of the Query object in the ES2009 Q1 release, but XML serialization is planned for Q2.)
    • For a service sample, refer to demo project ES2009WCF_Server, file Full->ESDemoService_Full.cs.
      • The service was created by right-clicking on the project, choosing WCF Service, and then replacing the DoWork() method with real methods, both on the interface file and on the class.
    • For a client sample, refer to demo project ES2009WCF_Full_ConsoleClient or ES2009WCF_Full_WinFormsClient.
      • The WCF client was bound by manually starting the server app (ES2009WCF_Server.exe) from Windows Explorer, right-clicking on the client project in Visual Studio, choosing "Add Service Reference...", entering the service URL as shown on the server app console (this is set in the server app's app.config), clicking "Go", expanding the tree, selecting the interface, and choosing OK.
      • By default, the Service Reference configuration has "Reuse types in referenced assemblies" checked.
  2. Without EntitySpaces DLLs referenced on the client:
    • You will be generating Lightweight Proxies for your clients. These are created from EntitySpaces' generator seperately by expanding the ProxyStub tree branch (in the Templates tab) and running the Client Side Proxy/Stub.
    • The server will still use the Full / Heavy Proxies; however, ...
    • You should plan on serializing/deserializing your objects manually, both on client and server. A wrapper class called XmlSerialized<T> is provided with the demo to make this easier.
    • You will not be able to use the Query object in the ES 2009 Q1 release.
    • For a service sample, refer to demo project ES2009WCF_Server, file Light->ESDemoService_Light.cs.
      • The service was created by right-clicking on the project, choosing WCF Service, and then replacing the DoWork() method with real methods, both on the interface file and on the class.
    • For a client sample, refer to demo project ES2009WCF_Light_ConsoleClient.
      • The WCF client was bound by manually starting the server app (ES2009WCF_Server.exe) from Windows Explorer, right-clicking on the client project in Visual Studio, choosing "Add Service Reference...", entering the service URL as shown on the server app console (this is set in the server app's app.config), clicking "Go", expanding the tree, selecting the interface, and choosing OK.
      • The sample app demonstrates how serialization/deserialization was performed with the lightweight proxies.

Pre-Setup

This demo requires SQL Server 2005 (Express, Standard, or Enterprise edition) to be installed and running on the machine you are running the demo on. (You can get SQL Server Express edition for free at http://www.microsoft.com/express/sql/default.aspx.)

Your SQL Server instance needs to recognize you as an administrator, as the demo server will auto-create the database and database tables when it runs. You can remove this behavior and create the demo database and table(s) manually by opening the app.config file in the ES2009WCF_Server project and changing the appSettings values of createDatabase and resetTableData to false.

If you do decide to create the database and table manually, here is how it should be configured. The database name should be ES2009WCFDemo. You should have the following table structure(s):

USE [ES2009WCFDemo]

/****** Object:  Table [dbo].[Employee]    Script Date: 01/21/2009 17:30:16 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

CREATE TABLE [dbo].[Employee](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [FirstName] [nvarchar](50) NULL,
    [Age] [tinyint] NULL,
    [Salary] [money] NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

This is the same SQL script that is used automatically (if enabled) when the demo server is run .

You also need to validate the connection string in the app.config file under ES2009WCF_Server. By default it points to the server ".\SQLExpress".

Creating The Employee EntitySpaces Objects

The first thing that was done when creating this demo was the creation of an Employee database table and the EntitySpaces objects that work with it. The Employee schema is described previously (see Pre-Setup). The EntitySpaces objects were placed in a shared library that contains all business objects that can be used both on the server and in a full (EntitySpaces-referencing) client. This is database-secure because a client does not have a database connection string in the generated code nor in its config file, it only has WCF references if so architected.

To generate EntitySpaces objects,

  1. Open the EntitySpaces generator by selecting Tools -> EntitySpaces in Visual Studio.
  2. In the Settings tab, click Configure Connection and point the generator to the Employee database. For this demo, the following was used:
    • Server: .\SQLExpress
    • Security: Integrated Security
    • Database: ES2009WCFDemo
  3. In the Templates tab, expand Templates->EntitySpaces->2009->C# and then select Generated - Classes Master (C#)
  4. Click the green Execute button.
  5. In the dialog that comes up, under Select the Output Path enter the file path to the shared library project that will be used to keep EntitySpaces business objects.
  6. The Namespace should be the namespace for your shared library.
  7. The Connection Name should be the name that will be used on your server to identify the connection string.
  8. The Tables or Views and Select Tables will be automatically selected as Tables and Employee, respectively.
  9. Click into the Proxy/Stub tab. Check the Generate the Proxy/Stub option as well as Support WCF.
  10. You should also specify a custom DataContract URI.
  11. When you click on OK, the files will be generated in the Output Path you specified.
  12. Go to Visual Studio's Solution Explorer, click on the shared library project, and then click the Solution Explorer toolbar button called "Show All Files". You should see the Generated folder that EntitySpaces created. Right-click on it and choose "Include".

When using lightweight proxies/stubs, will need to run the generator again for the client project to create special lightweight proxies/stubs. Remember that lightweight proxies/stubs are used primarily if your shared library, as well as EntitySpaces' runtime libraries, will not be referenced by the client application. So in this case, the client will need generated stubs.

So to create the lightweight proxies/stubs for the client, follow the same steps as for creating the "Classes Master" objects, except:

  1. Instead of using the template Generated - Classes Master (C#), expand ProxyStub and select Client Side Proxy/Stub
  2. In the field Select the Output Path, enter the path to your client app project instead of the shared library which will not be referenced in your client app.

Creating The WCF Server

The WCF Server in this demo (project ES2009WCF_Server) is just a console application with ServiceHost. You can also host WCF services in IIS 7 or with WAS (Windows Activation Services) but that is beyond the scope of this demo; again, WCF education is not the intent with this demo but rather how EntitySpaces can work in a WCF architecture.

Initializing EntitySpaces For The WCF Server

Before doing anything with EntitySpaces within a server application, an app.config file needs to be created.

  1. Right-click the server app project in Solution Explorer and select Add Item...
  2. Select Application Configuration file. (Retain the default filename, app.config.)
  3. When the file is added to the project, click on the file in Solution Explorer, then under Properties set Copy to Output Directory to Copy if newer. Note: Visual Studio automatically renames this file to %assemblyname%.config in the output directory when the project is built.

After setting up the app.config file with EntitySpaces settings, the first thing our server app needs to do in order to work with EntitySpaces and with the database is initialize EntitySpaces with:

esProviderFactory.Factory 
    = new EntitySpaces.LoaderMT.esDataProviderFactory();

About The XmlSerialized<T> and BinarySerialized<T> Wrappers

Before moving on, it should be noted that there are a few scenarios where manual serialization must be used when working with EntitySpaces over WCF. While EntitySpaces business objects can be generated with WCF compliance, EntitySpaces was not built around WCF (WCF is a relatively young technology, and Visual Studio's and .NET SDK's generation of WCF stubs is not fully evolved to handle all scenarios). For example, the manual serialization is necessary to retain the behavioral functionality of the EntitySpaces objects such as change/dirtiness state on the client in the conformance pattern used by EntitySpaces.

Examples of manual serialization for WCF have been posted in the EntitySpaces forums and blog, namely

  1. here: EntitySpaces WebServices Example Application (with WCF implications)
  2. and here: Pure WCF Client Side Proxies

The samples provided prompted the creation of a pair of serialization wrappers that I, the creator of this demo, decided to produce both for this demo and for future use anywhere manual serialization/deserialization is needed.

I posted the wrappers and documented them on my own blog:

Jon Davis: XmlSerialized<T> and BinarySerialized<T>

These wrappers are used extensively throughout this demo, primarily:

  • BinarySerialized<T>, utilized for exposing the Query object over WCF for full proxy clients.
  • XmlSerialized<T>, utilized for exposing all lightweight proxies/stubs for the lightweight clients that do not reference EntitySpaces.

Creating The Full & Lightweight Proxy Services

To create a WCF service that exposes API points for clients, Visual Studio's WCF Service template items were used:

  1. Right-click on the server project in Solution Explorer and select Add -> New Item...
  2. Select WCF Service and give it an appropriate name.
  3. In the generated interface file (the file prefixed with an 'I'), replace the DoWork() method interface declaration with the methods that are appropriate for your service. (Don't forget to mark each method with the [OperationContract] attribute.)
  4. In the generated class file, just right-click on the interface name where the class name is declared, and select "Implement interface". You may want to remove the #region markers to keep it clean.
  5. The generated method stubs should look like the ones illustrated in the ES2009WCF_Server project, under the Full and Light directories.
    • The Full directory demonstrates a service that would be used for clients that can reference EntitySpaces runtime libraries and would therefore also reference a shared library that is referenced by both client and server.
    • The Light directory demonstrates a service that would be used for clients that do not reference EntitySpaces runtime libraries. These clients would need the lightweight proxies/stubs to be generated specifically for the client. For more information, see the earlier section Creating The Employee EntitySpaces Objects.

About The Server Demo Tests

Some simple tests were added to the ES2009WCF_Server project while creating the server just to make sure things are working. This isn't a TDD implementation but basic invocation of some of the services' API is demonstrated.

The Console-Based Full Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The first client that was created for this demo was the Console-Based Full Proxy Client. This is just a console application that invokes some of the WCF API points. It was created to test and make sure that the WCF services were working correctly. The net result is a demonstration of code that illustrates how EntitySpaces can interact with a WCF service using full proxies.

The verbiage of "full proxies" used here means that the client has EntitySpaces runtime libraries referenced, as well as a shared library that contains the business objects used on the server. The client sees these objects in the same way as the server sees these objects. The only difference is that the client cannot invoke the database directly through the EntitySpaces API. Instead, WCF must be used to explicitly manage all queries using the API points established by the server's WCF services.

Note that the "full proxy" implementation partially supports binary serialization of Query objects so that you can perform a filtered query from a client over WCF. This is partially demonstrated in the demo app by filtering on the Employee's FirstName property.

The Console-Based Lightweight Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The Console-Based Lightweight Proxy Demo Client is a complete API demonstration of the WCF service that was exposed for lightweight proxies. It does not reference EntitySpaces runtime libraries nor any shared libraries except for core .NET libraries and the project that contains the Serialized utility classes discussed earlier.

Note that the special proxy/stub classes were generated for this client and added to the client project.

The WinForms-Based Full Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The WinForms-Based Full Proxy Demo Client is a rich GUI illustration of how WCF can be used in a client/server application. It automatically loads all employees, allows you to edit the details of an employee, allows you to delete an employee, and allows you to create an employee. It also demonstrates the use of a binary-serialized Query object by displaying a filter form with a name parameter and range parameters for Age and Salary.

Coming Soon: The WPF-Based Lightweight Proxy Demo Client

We will be working on a WPF-based client that demonstrates the use of the lightweight proxy/stub classes to be released hopefully in the near future.

When EntitySpaces 2009 Q2 is released we will also have XML-serializable queries as well as a fresh new updated Silverlight demo that illustrates its use. This, too, will utilize the lightweight proxy/stub classes that unfortunately the ES 2008 Silverlight demo [1, 2] did not properly illustrate as the proxy/stub classes were not generated for it.

Closing Comments

Hopefully this sample solution clearly demonstrates how EntitySpaces can work with WCF without any significant hassle.

Jon Davis produced this demo as an outside consultant. He is currently employed as a C#/NET Developer for a very prominent Internet services provider, but offers evening/weekend consulting services for both software and web solutions. He retains a blog at http://www.jondavis.net/techblog/.
posted on Sunday, January 25, 2009 6:15:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, January 15, 2009

The Developer Site

We are working hard on expanding our new developer site and you should definitely begin to use this site. The search feature is very good. More and more on our forums we will be pointing you to the developer site. All of the samples are provided in C# and VB.NET. Two recent additions include:

  • EntitySpaces 2009 Application Documentation

http://www.developer.entityspaces.net/documentation/EntitySpaces2009/WhatsNew.aspx

  • SubQuery Documentation

http://www.developer.entityspaces.net/documentation/DynamicQuery/SubQuery/SelectSubQuery.aspx

VB.NET Sample Application

We will also be providing a VB.NET sample application matching our current C# sample with both the Trial and Developer installs.

WCF Sample Application

Finally, we are creating a very informative WCF sample application that will be available for download. It will also be presented most likely in a two part blog posting as well (and included in our developer site). This sample app will demonstrate end-to-end how to use our Full Proxy (FP) and Lightweight Proxies (LP) in WCF scenarios.

wcf_sample

 

So, remember to search on our developer site before posting on our forums to see if you can find your answer there. Remember, we will continually be adding new content.

EntitySpaces

From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, January 15, 2009 11:20:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, January 13, 2009

Effective February 2, 2009 we are changing the price of our EntitySpaces Developer version. EntitySpaces Developer licenses are licensed per developer seat. A developer seat is required for each developer that uses the EntitySpaces API which includes using the generated classes in their programming tasks. The EntitySpaces Source Code does not count as a developer license.

The last time we changed our prices was in February of 2007, that was two years ago. EntitySpaces 2009 is a substantial improvement over EntitySpaces 2008 when it comes to Code Generation with the addition of our Visual Studio Integration. There are some very cool enhancements planned for the ES2009 architecture after the Q1 release. If you are a current customer you can renew your license before the February 2nd, 2009 price increase one time.


The new pricing is as follows:

Developer Version

Current =>  149.00 Per Developer   89.40 Renewal
As of Feb 2nd, 2009= >  299.00 Per Developer 179.40 Renewal

Source Code  

Remains Unchanged =>  499.00 Per Developer 299.40 Renewal

Quantity Discounts

    • 2  to  4 developer licenses     = 10% 

    • 5 or more developer licenses = 20%

         Quantity discounts apply to items purchased at the same time.

      EntitySpaces

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Tuesday, January 13, 2009 9:02:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, January 11, 2009

      Currently only the EntitySpaces Developer is available, the Trial version is not yet available. The Trial version will be published on the 12th (Monday night EST time). You can install Beta III right over the top of Beta II.

      Here are the fixes and enhancements in Beta III (Version 2009.0.0112.0).

      • The "What's New" tab now loads asynchronously so it no longer effects load time.
      • Added "Ctrl + A" support to select all tables or views in the template user interfaces. This was done on all table/view selection listboxes (excluding the Web Admin Grid templates).
      • There are now "Most Recently Used" lists available on both the Projects tab and Settings tab.
      • The Custom Master templates no longer overwrite existing files.
      • Fixed an error that could occur when saving project files.
      • Enhanced the Settings -> Naming Conventions -> Stored Procedure tab to help you visual customizations. We will also be doing this for the Class Names and Hierarchical tabs.

      The EntitySpaces.CommandLine.exe utility is also well underway. Once completed we will move from the beta to release candidate phase.

      EntitySpaces

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Sunday, January 11, 2009 10:00:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Wednesday, January 07, 2009

      This is not an example how to use EntitySpaces. Most everything shown below can be done through our DynamicQuery API which is the preferred way. For instance, the GetMaxSalary() example shown in the EmployeesCollection class below could be done via our DynamicQuery like this:

      EmployeesQuery query = new EmployeesQuery();
      query.Select(query.Salary.Max());
      int maxSalary = (int)query.ExecuteScalar();
      And the CustomLoad() load method shown in the EmployeesCollection class below could be done via our DynamicQuery like this: 
      
      EmployeesCollection coll = new EmployeesCollection();
      coll.Query.Where(coll.Query.LastName.Like("g%"));
      if(coll.Query.Load())
      {
          // Then we loaded at least one record
      }

      So, when you look at the class below remember this is merely to demonstrate to you some of the lower level support functions that you have at your disposal. The idea being, of course, even though you are using an ORM system generated via our ES2009 code generator you are not cut off from the low level ADO.NET API when you need to hug the metal.

      public partial class EmployeesCollection : esEmployeesCollection
      {
          public bool CustomLoad(string partialName)
          {
              // This populates the EmployeesCollection itself
              return this.Load(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", partialName);
          }
      
          public DataSet GetDataSet(int someParameter)
          {
              // We hate DataSets ;)
              return this.FillDataSet(esQueryType.StoredProcedure, "TestProc", someParameter);
          }
      
          public DataTable GetDataTable(int someParameter)
          {
              // We hate DataTables ;)
              return this.FillDataTable(esQueryType.StoredProcedure, "TestProc", someParameter);
          }
      
          public IDataReader GetReader(string partialName)
          {
              // We hate DataReaders ;)
              return this.ExecuteReader(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", partialName);
          }
      
          public int GetMaxSalary()
          {
              return (int)this.ExecuteScalar(esQueryType.StoredProcedure, "procGetMaxSalary");
          }
      }


      Of course, we don't really hate DataSets, DataTables, or DataReaders. If you are an EntitySpaces user then you know that using our DynamicQuery API is the way to go. However, if there is something you need that is not available in our DynamicQuery API you have full access to the underlying power of ADO.NET.

      There is also a utility class called esUtility that will allow you to access this lower level API without adding custom methods to your EntitySpaces classes. This can be useful when what you need to do doesn't really belong to a particular entity. Here is an example of using the esUtility class.

      esUtility util = new esUtility();
      IDataReader reader = util.ExecuteReader(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", "g%");

      One thing to note is that you never use decorators on your parameters such as ? or @ or : (depending on your database). The EntitySpaces Data Providers do this for you. For instance, notice in the sample code below that we do not set the parameter name to "@Salary" rather we just use "Salary". This allows you to access stored procedures and still have a database independent application as the EntitySpaces Data Provider will "gussy up" the parameters with the proper decorator. In fact,  you really don't have to use the syntax below unless you need to provide extra information such as parameter direction or perhaps the precision or scale of a decimal for some reason. Otherwise you can just use the {0}, {1} syntax as shown above in the GetReader() method. Even when using the {0} syntax EntitySpaces will create a true parameter for you to ensure that no SQL injection attacks are successful.

      esParameters parameters = new esParameters();
      esParameter param = new esParameter("Salary", null, esParameterDirection.Output);
      parameters.Add(param);
      
      esUtility util = new esUtility();
      IDataReader reader = util.ExecuteReader(esQueryType.StoredProcedure, "GetMaxSalary", parameters);

      While were at it here's another data access tip. This tip allows you to trick your table based collection (via the DynamicQuery) to query against a view. Of course, you can generate entities from a view if you like but if you don't really want the additional classes you can use this technique instead. Notice how we set the QuerySource below.

      EmployeesCollection coll = new EmployeesCollection();
      coll.Query.es.QuerySource = "MyView"; // <== Select against this view
      coll.Query.Select(coll.Query.LastName, coll.Query.FirstName);
      coll.Query.Where(coll.Query.Salary > 50000);
      coll.Query.Load();

      This can be very useful since you can still commit this data back to the Employee table provided that you also brought back the primary key, of course. And remember, these are tricks, not necessarily how to use EntitySpaces. You can easily use our DynamicQuery API to build a join on the fly to that would accomplish the same thing as the view above.

      In summary we have worked very hard to expose all of the underlying power of ADO.NET and yet you never have to pull in SqlClient, OracleClient or any other ADO.NET provider. Better still you can invoke stored procedures and not lose database independence if that is what you are after. We hope you have learned a thing or two from this post.

      EntitySpaces

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.


      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Wednesday, January 07, 2009 11:37:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, January 04, 2009

       

                                     

      posted on Sunday, January 04, 2009 6:48:54 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, January 02, 2009

      The ES2009 Beta II for both the Developer and Trial are now available for download. The version is 2009.0.0103.0 and you can install it right over the top of the previous Beta, just make sure you have Visual Studio closed.

      • User Metadata now truly works.
      • The C# and VB Web Admin Grids are available (documentation coming upon official release).
      • The DotNetNuke SQL Template is available. 
      • Npgsql 2.0.2.0 will now work during code generation (PostgreSQL Driver)

      At this point we are 100% functional. Everything should work, including Projects.  Now we merely "Beta" and work on the documentation and help files.

      We will also be creating some new video's, one on our Project files and one on how to use the Web Admin Templates.


      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Friday, January 02, 2009 11:09:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Monday, December 29, 2008

      For those of you interested in the ASPX Admin Suite you will be happy to know these templates are being converted over into our ES2009 code generation model. The templates and the GridLoaders will be included with the installation and included in our BETA 2 which should be the final beta before the official ES2009 release. We are already generating fully functional admin pages via our C# Admin Suite and after we fully unit test it and fix any bugs mentioned in our forums we will create the VB.NET version. We will also provide much better documentation regarding how to generate your Admin Suite and what all the features in this powerful template do. The image below shows the ES2009 ASPX Admin Suite running under ES2009. The demo can be found HERE and we will upgrade it to our ES2009 model once we complete the templates.

       image

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Monday, December 29, 2008 8:41:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Thursday, December 25, 2008

      We have created a very simple video that demonstrates how to build your first EntitySpaces 2009 application. This presentation really demonstrates how easy it is to create your application using EntitySpaces 2009 which is fully integrated into Visual Studio. This is the first in a series of videos that will demonstrate the power of EntitySpaces 2009.

      Click on the image below to start the video. Give it a moment to load.

      image

       

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Thursday, December 25, 2008 10:15:16 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, December 21, 2008
      kick it on DotNetKicks.com

      We are pleased to make the EntitySpaces 2009 Beta available for public release. The EntitySpaces 2009 Trial version is fully integrated with Visual Studio 2005 or 2008. There is also a stand alone executable for those not using Visual Studio.

      EntitySpaces 2009 Visual Studio Add-In features

      • Settings Tab   - Connect to your database and customize your code generation settings.
      • Projects Tab   - Record and playback code generation templates.
      • Templates Tab  - Execute Templates.
      • Metadata Tab   - Online database metadata and user defined metadata.
      • Mappings Tab   - Database to property type mappings.
      • What's New Tab - Keep you up-to-date with EntitySpaces News.

      If you are looking at starting a new project in 2009 take a look at EntitySpaces 2009. It's a great architecture and we no longer rely on a third party code generator. To get started, simply install and switch to the "Settings" tab and connect to your database and click the "Save" icon and you're off and running. We will be publishing a series of video's on how to use ES2009 soon. Watch for these on our blog.

      NOTE:
      After installation you should see "EntitySpaces" on the Visual Studio "Tools" menu. If you do not see it go to your Programs -> "EntitySpaces 2009" menu you will find a "Manual Setup" PDF file which outlines a few simple steps performed within Visual Studio to manually add EntitySpaces to your Visual Studio Tools menu. It's really very easy. If you are using an international version of windows you will need to follow those steps.

      Also, if you have the alpha or pre-beta installed:

      1. Close all instances of Visual Studio
      2. Uninstall the ES2009 Alpha or Pre-Beta
      3. Delete your C:\Documents and Settings\All Users\Application Data\EntitySpaces folder (will be a different folder on Vista)
      4. Now install the ES2009 Beta and go to the "Settings" tab and reconnect to your database  (THEN PRESS THE SAVE ICON ON THE SETTINGS TAB)

              

       

      EntitySpaces Features

      • Mono Support
      • Compact Framework Support
      • Medium Trust Support
      • Design Time Data Binding
      • Hierarchical Data Models
      • Powerful Dynamic Query API
      • Binary and XML Serialization
      • Data Provider Independence
      • Two Different Transaction Models
      • Saving via Stored Procedures or Dynamic SQL
      • Generated from your Database Schema
      • No XML mapping files. 
      • LINQ Support for Collections
      • Regenerate Without Losing Custom Business Logic
      • Source Code Available

       

      EntitySpaces

      From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Sunday, December 21, 2008 8:13:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]