The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

ES v1.1021.0 Beta Release

Last post 10-21-2007, 4:42 PM by ESAdmin. 0 replies.
Sort Posts: Previous Next
  •  10-21-2007, 4:42 PM 5956

    ES v1.1021.0 Beta Release

    New Installs: The latest MyGeneration (1.2.0.7 or higher) should be installed first, and then closed, before installing EntitySpaces Developer or Trial.

    1. You can download MyGeneration 1.2.0.7 HERE
    2. An updated VistaDB 3.2 Build 43 MyMeta plugin for MyGeneration is installed to the MyGeneration Program folder during the EntitySpaces install. 

    EntitySpaces 2007 is a full install. You do not need an earlier version installed. To generate against MySQL, MyGeneration requires that MySql.Data.dll be copied to the MyGeneration Program Folder. After installing, please see the "Getting Started" PDF that is added to your EntitySpaces Start Menu folder.


    Below are the release notes for EntitySpaces 2007.1.1021.0 Beta:

     


    Things changed since our last beta. We no longer us any attributes for our hierachical binding. Our Compact Framework support prevents us from using attributes as we do not intend on supporting two different codebases. Thus, our databinding was reworked from our last beta and it is so much easier, and better. This release fully supports the Compact Framework. We really encouage you to use this version if you can. If you are doing Windows.Forms development you will really enjoy the power in this build.

    We feel this is a very solid beta, our Compact Framework support works just fine as well.

    Windows.Forms Hierarchical Databinding

    For Windows.Forms developers hierarchical binding is now supported. There is new flag on your collection classes called EnableHierarchicalBinding that is true by default. You can turn if off in the designer by selecting your collection and setting that property to false.

    Extended Properties

    The old method CreateExtendedProperties() is no longer supported and no longer exists. The concept of extended properties themselves really no longer exist. They are simply not needed. You will see as you read further.

    Virtual Columns

    A virtual column is any column that is brought back from a query, a stored procedure, or any other data fetching mechanism that is not in your core table or view. For instance, if you use our new "join" syntax to bring back any extra columns from other tables, these extra columns are referred to as virtual columns. All virtual columns are now bindable at runtime by default. For instance, if you bring back an extra column named "FullName" that column will exist as a "virtual property" for binding purposes only, and can be seen automatically by whatever you are binding to (not via intellisense though).

    Local Binding Properties

    Local binding properties always show up in design time mode. There are two classes, both shown below. All columns added during GetLocalBindingProperties() will always be available in design time.

    • The FakeColumn property below must be added in the GetLocalBindingProperties() if you want to make it available during runtime. The reason you must do this is that it is not contained in the underlying DataTable and EntitySpaces knows nothing about it. Of course, adding it here also means it will be available in design time.
    • The FullName property below is only added to the GetLocalBindingProperties() because we want it to show up in design time. Since it is returned in the underlying DataTable it will aways be available at runtime.
    namespace BusinessObjects
    {
    public partial class Employee : esEmployee
    {
    protected override List GetLocalBindingProperties()
    {
    List props = new List();

    props.Add(new esPropertyDescriptor(this, "FakeColumn", typeof(string)));
    props.Add(new esPropertyDescriptor(this, "FullName", typeof(string)));

    return props;
    }

    public string FakeColumn
    {
    get { return f; }
    set { f = value; }
    }

    public string FullName
    {
    get { return (string)this.GetColumn("FullName"); }
    set { this.SetColumn("FullName", value); }
    }

    private string f = "wow man";
    }
    }

    IDataErrorInfo Implementation

    The IDataErrorInfo Implementation lives in the esEntity.cs class (your single entities base class) and here is the actual implementation. 

    #region IDataErrorInfo Members

    string IDataErrorInfo.Error
    {
    get
    {
    return ((IDataErrorInfo)this)[string.Empty];
    }
    }

    string IDataErrorInfo.this[string columnName]
    {
    get
    {
    string result = string.Empty;
    esColumnMetadata columnMeta = this.Meta.Columns[columnName];

    if (this.OnValidateDelegate != null)
    {
    result = OnValidateDelegate(columnName, this, columnMeta);
    }

    if (string.IsNullOrEmpty(result))
    {
    result = this.Validate(columnName, this, columnMeta);
    }

    return result;
    }
    }

    virtual public string Validate(string columnName, esEntity entity, esColumnMetadata metadata)
    {
    return string.Empty;
    }

    public delegate string ValidateDelegate(string columnName, esEntity entity, esColumnMetadata metadata);

    public event ValidateDelegate OnValidateDelegate;

    #endregion

    There are two ways to use take advantage of the IDataErrorInfo implementation, by delegate, or by a virtual/overrideable method. Below are a few examples. They might not make to much sense, but they should show you the simple mechanics. The nice thing about this approach is that you are handed the Column Name, the actual esEntity, and the esColumnMetadata for the column.

    To use the virtual Validate() method you simply overload/Override it in your custom class like this: 

    namespace BusinessObjects
    {
    public partial class Employees : esEmployees
    {
    public override string Validate(string columnName, esEntity entity, esColumnMetadata metadata)
    {
    Employees employeeToValidate = entity as Employees;
    if (employeeToValidate != null)
    {
    if (columnName == EmployeesMetadata.ColumnNames.LastName && employeeToValidate.LastName.Length < 15)
    {
    return "Virtual method says we do not like employees with short last names";
    }
    }

    return string.Empty;
    }
    }
    }

    To use the delegate you would take this approach in your winform (or wherever)

    private void FirstNameTextBox_Validated(object sender, EventArgs e)
    {
        emp.OnValidateDelegate = new EntitySpaces.Core.esEntity.ValidateDelegate(emp_OnValidateDelegate);
        Control control = (Control)sender;

    foreach (Binding binding in control.DataBindings)
    {
    if (binding.IsBinding)
    {
    IDataErrorInfo errorInfo = (IDataErrorInfo)binding.DataSource;
    errorProvider1.SetError(control, errorInfo[binding.BindingMemberInfo.BindingField]);
    }
    }
    }


    string emp_OnValidateDelegate(string columnName, EntitySpaces.Core.esEntity entity, EntitySpaces.Interfaces.esColumnMetadata metadata)
    {
    Employees employeeToValidate = entity as Employees;
    if (employeeToValidate != null)
    {
    if (columnName == EmployeesMetadata.ColumnNames.FirstName && employeeToValidate.FirstName.Length < 15)
    {
    return "The delegate says we do not like people with short first names";
    }
    }
    return string.Empty;
    }

    Hierarchical Properties - Forcing a Reload (breaking change)

    All hierarchical properties now have a "set" which you can call. However, you can only set it to Null / Nothing otherwise an exception will be thrown. The set looks something like this: 

    set 
    {
    if (value != null) throw new Exception("'value' Must be null");

    if (this._EmployeeCollectionBySupervisor != null)
    {
    this.RemovePostSave("EmployeeCollectionBySupervisor");
    this._EmployeeCollectionBySupervisor = null;
    }
    }

    This means you can now do this ...

     employee.EmployeeCollectionBySupervisor[1].FirstName = "mike"; // lazy loaded upon first access
    employee.EmployeeCollectionBySupervisor = null; // discard it
    employee.EmployeeCollectionBySupervisor[1].FirstName = "mike"; // the entire collection was re-loaded
    The breaking change comes into play for esEntity based hierarchical objects, you use to be able to perform this operation.  
     employee.UpToEmployeeBySupervisor = employeeObject;

    now you must do: 

     employee.Supervisor = employeeObject.EmployeeID;

    Nullable Types - Experimental (at this point we suggest you don't use this)

    If you run the EntitySpaces - Set esPlugin Settings template you will see a new checkbox named "Use Nullable Types Always" which is set to true. This is how we have always handled nullable types. However, if you set this to "false" then only columns that allow null will be nullable types. We have done some testing on this, however, for those of you that are interested in this support, we need your help in testing. The only drawback right now is that our proxy's do not support this feature yet, so if you check the proxy checkbox and generate the proxies you will get compile errors.

    SQL Server Paging with Joins

    This bug was fixed.

    VistaDB 3.2 - Build 43 (it was still warm, you could just smell the butter)

    We are now compiled against VistaDB 3.2 Build 43

    ** Special PostgreSQL instructions **

    MyGeneration ships with the PostgreSQL native column type to C# mappings named differently than the EntitySpaces templates expect them. However, this can be easily corrected in a few quick seconds by following these these steps (VB.NET users follow these same steps, EntitySpaces uses only the C# mappings even for VB.NET):

    1. Open MyGeneration
    2. Connect to your PostgreSQL database using the MyGeneration Default Settings dialog. It's under the "Edit -> Default Settings ..." menu
    3. Click on the "Language Mappings" toolbar button (4th from the right - use tooltips)
    4. Select "C# System Types" in the drop down combobox in the "Language Mappings" dockable window.
    5. Click on the "Create New Language Mapping" icon (white icon on the "Language Mappings" dockable window)
    6. In the popup dialog for the Language type in C# and Based Upon select C# System Types
    7. Click on the "OK" button
    8. Click on the "Save" icon on the  "Language Mappings" dockable window
    9. Close and reopen MyGeneration, you're all set.

    The above instructions are a one time operation, you will not have to do them again.

     The EntitySpaces.NpgsqlProvider.dll uses Npgsql version 1.0. It should be installed with your PostgreSQL 8.2 installation. It can, also, be found HERE.

View as RSS news feed in XML