/* |-------------------------------------------------------------------------------| | Copyright © Computer Ease Limited | | Address: 1/9 Bloack-A Lalmatia, Dhaka-1207, Bangladesh | | Email: info@celimited.com, cease@bol-online.com, web: www.celimited.com | | Unauthorized copy or distribution is strictly prohibited | | Author: S. M. Russel, Last modified date: 18/04/2009 | |-------------------------------------------------------------------------------| */ using System; using System.Data; using System.Data.SqlClient; using Ease.Core.Model; using System.Collections.Generic; using Ease.Core; using Ease.Core.DataAccess; namespace Ease.Core.Model { #region Framework: Service base public abstract class ServiceTemplate { private string _svcName; private string _endPoint; public ServiceTemplate(string svcName) { _svcName = svcName; } public ServiceTemplate() { _svcName = ""; } public bool IsAlive { get { return true; } } public string ServiceName { get { return _svcName; } set { _svcName = value; } } internal void SetEndPoint(string value) { _endPoint = value; } protected string EndPoint { get { return _endPoint; } } protected void SetObjectID(ObjectTemplate ot, int id) { ot.SetID(id); } protected void SetObjectID(ObjectTemplate ot, long id) { ot.SetID((int)id); } protected void SetObjectState(ObjectTemplate ot, ObjectState state) { ot.SetState(state); } protected void SetObjectReadOnlyProperties(ObjectTemplate ot, params object[] propertyValues) { ot.SetReadOnlyProperties(propertyValues); } protected abstract T CreateObject(DataReader dr) where T : ObjectTemplate; /// /// Return collection of objects of type T. /// /// Type of object. /// A valid datareader. /// Return List of type T. protected List CreateObjects(DataReader dr) where T : ObjectTemplate { List list = new List(); while (dr.Read()) { T ot = this.CreateObject(dr); ot.SetState(ObjectState.Saved); list.Add(ot); } return list; } } #endregion }