MyGeneration to partner with Gentle.NET

Is there a feature you'd like us to add? Post it here.

MyGeneration to partner with Gentle.NET

Postby mike.griffin on Fri May 21, 2004 3:49 pm

MyGeneration was contacted by Morten Mertner of Gentle.NET to see if we would be interested in generating Business Objects for Gentle.NET, after a little investigation this seems quite doable, so it is in the queue.

Gentle.NET is an RDBMS independent object persistence framework. It features automatic SQL generation and object construction, an SQL factory for creating custom queries, DataView construction helpers, excellent performance and reasonably complete docs. For additional information please visit the project home at http://www.mertner.com/projects/gentle

Gentle.NET has a user base numbering into the thousands so this would serve to introduce a whole host of new users to the power of MyGeneration, and Gentle.NET users will no longer have to code things by hand thereby saving them a tremendous amount of time, this is a win/win for MyGeneration and Gentle.NET.

This is going to prove to be an interesting and advanced addition to MyGeneration and should demonstrate the flexibility of our model. If all goes smoothly we will be shipping Gentle.NET templates with MyGeneration in the next couple of weeks.
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby sbc on Fri May 21, 2004 4:02 pm

That should be good. I remember mentioning it in the dOOdads forum. This site could end up a bit busy, and we should hopefully see a few more quality templates.
User avatar
sbc
Expert
 
Posts: 446
Joined: Sat Apr 03, 2004 6:10 am
Location: North East Lincolnshire, England

Postby mike.griffin on Fri May 21, 2004 6:23 pm

Here is what a Gentle.NET business object looks like. This is the Northwind Employees table. Notice the use of attributes and Gentle.NET does some hierarchical stuff too. The code looks pretty easy to generate actually, so after my CRUD sample I'm going to do this, I love writing templates :twisted:

Code: Select all
/*
* >>> Insert file summary here
* >>> Insert file copyright notice here
* >>> Insert \"Generated by MyGeneration\" here
*
* >>> Insert license notice below, e.g.:
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License 2.1 or later, as
* published by the Free Software Foundation. See the included License.txt
* or http://www.gnu.org/copyleft/lesser.html for details.
*
* >>> Insert source code repository header (for revision tracking) below, e.g.:
* $Id: $
*/
using System;
using System.Collections;
using Gentle.Framework;

namespace MyNameSpace
{
   #region Employee
   /// <summary>
   /// This object represents the properties and methods of a Employee.
   /// </summary>
   [Serializable]
   [TableName(\"Employees\")]
   public class Employee : Persistent
   {
      #region Members
      private int employeeId;
      private string lastName = String.Empty;
      private string firstName = String.Empty;
      private string title;
      private string titleOfCourtesy;
      private DateTime birthDate;
      private DateTime hireDate;
      private string address;
      private string city;
      private string region;
      private string postalCode;
      private string country;
      private string homePhone;
      private string extension;
      private byte[] photo;
      private string notes;
      private int reportsTo;
      private string photoPath;
       #endregion

      #region Constructors
      /// <summary>
      /// Create a new Employee using the minimum required information (all not-null fields except
      /// auto-generated primary keys).
      /// </summary>
      /// <param Name=\"lastName\"></param>
      /// <param Name=\"firstName\"></param>
      /// <returns>An Employee business entity</returns>
      public Employee( string lastName, string firstName )
      {
         this.employeeId = 0;
         this.lastName = lastName;
         this.firstName = firstName;
      }

      /// <summary>
      /// Create a new Employee by specifying all fields (except the auto-generated primary key field).
      /// </summary>
      public Employee( string lastName, string firstName, string title, string titleOfCourtesy,
         DateTime birthDate, DateTime hireDate, string address, string city, string region,
         string postalCode, string country, string homePhone, string extension, byte[] photo,
         string notes, int reportsTo, string photoPath ) :
         this( lastName, firstName )
      {
         this.title = title;
         // remaining fields...
      }

      /// <summary>
      /// Create an Employee from an existing row of data. This will be used by Gentle to
      /// construct objects from retrieved rows.
      /// </summary>
      public Employee( int id, string lastName, string firstName, string title, string titleOfCourtesy,
         DateTime birthDate, DateTime hireDate, string address, string city, string region,
         string postalCode, string country, string homePhone, string extension, byte[] photo,
         string notes, int reportsTo, string photoPath ) :
         this( lastName, firstName, title, titleOfCourtesy, birthDate, hireDate, address, city,
            region, postalCode, country, homePhone, extension, photo, notes, reportsTo, photoPath )
      {
         this.employeeId = id;
      }

      /// <summary>
      /// Static fetch method to create an Employee from an existing row of data.
      /// </summary>
      public static Employee Retrieve( int id )
      {
         Key key = new Key( typeof(Employee), true, \"Id\", id );
         return Broker.RetrieveInstance( typeof(Employee), key ) as Employee;
      }
      #endregion
      
      #region Public Properties
      [TableColumn(\"EmployeeID\", NotNull=true), PrimaryKey(AutoGenerated=true)]
      public int Id
      {
         get{ return employeeId; }
         set{ employeeId = value; }
      }
      [TableColumn(\"LastName\", NotNull=true)]
      public string LastName
      {
         get{ return lastName; }
         set{ lastName = value; }
      }
      [TableColumn(\"FirstName\", NotNull=true)]
      public string FirstName
      {
         get{ return firstName; }
         set{ firstName = value; }
      }
      [TableColumn(\"Title\")]
      public string Title
      {
         get{ return title; }
         set{ title = value; }
      }
      [TableColumn(\"TitleOfCourtesy\")]
      public string TitleOfCourtesy
      {
         get{ return titleOfCourtesy; }
         set{ titleOfCourtesy = value; }
      }
      [TableColumn(\"BirthDate\")]
      public DateTime BirthDate
      {
         get{ return birthDate; }
         set{ birthDate = value; }
      }
      [TableColumn(\"HireDate\")]
      public DateTime HireDate
      {
         get{ return hireDate; }
         set{ hireDate = value; }
      }
      [TableColumn(\"Address\")]
      public string Address
      {
         get{ return address; }
         set{ address = value; }
      }
      [TableColumn(\"City\")]
      public string City
      {
         get{ return city; }
         set{ city = value; }
      }
      [TableColumn(\"Region\")]
      public string Region
      {
         get{ return region; }
         set{ region = value; }
      }
      [TableColumn(\"PostalCode\")]
      public string PostalCode
      {
         get{ return postalCode; }
         set{ postalCode = value; }
      }
      [TableColumn(\"Country\")]
      public string Country
      {
         get{ return country; }
         set{ country = value; }
      }
      [TableColumn(\"HomePhone\")]
      public string HomePhone
      {
         get{ return homePhone; }
         set{ homePhone = value; }
      }
      [TableColumn(\"Extension\")]
      public string Extension
      {
         get{ return extension; }
         set{ extension = value; }
      }
      [TableColumn(\"Photo\")]
      public byte[] Photo
      {
         get{ return photo; }
         set{ photo = value; }
      }
      [TableColumn(\"Notes\")]
      public string Notes
      {
         get{ return notes; }
         set{ notes = value; }
      }
      [TableColumn(\"ReportsTo\"), ForeignKey(\"Employees\", \"EmployeeID\")]
      public int ReportsToId
      {
         get{ return reportsTo; }
         set{ reportsTo = value; }
      }
      [TableColumn(\"PhotoPath\")]
      public string PhotoPath
      {
         get{ return photoPath; }
         set{ photoPath = value; }
      }
      #endregion
      
      #region Relations
      /// <summary>
      /// 1:1 relation
      /// </summary>
      public Employee ReportsTo
      {
         get{ return reportsTo != 0 ? Retrieve( reportsTo ) : null; }
         set{ reportsTo = value.Id; }
      }
      /// <summary>
      /// 1:n relation
      /// </summary>
      public IList Orders
      {
         get{ return Broker.RetrieveList( typeof(Order), this.GetKey() ); }
      }
      /// <summary>
      /// n:m relation
      /// </summary>
      public GentleList Territories
      {
         get{ return new GentleList( false, typeof(Territory), this, typeof(EmployeeTerritory) ); }
      }
      #endregion

      /// <summary>
      /// Fetch a list of all employees.
      /// </summary>
      static public IList ListAll
      {
         get{ return Broker.RetrieveList( typeof(Employee) ); }
      }
   }
   #endregion Employee
}
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby mike.griffin on Wed Jul 14, 2004 4:55 pm

User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby angelo on Thu Jan 20, 2005 3:39 pm

The template has moved to the Gentle.NET Subversion repository, and its manual can now be found here:

http://www.mertner.com/confluence/displ ... d+software

Bleeding edge copies will be available on Gentle.NET Subversion:

http://www.mertner.com/svn/repos/projects/gentle

And release versions will continue to be posted on the MyGeneration Template Library. Expect a 'major release' there in the first half of February 2005
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands


Return to Enhancements

Who is online

Users browsing this forum: No registered users and 2 guests

cron