当前位置: 首页>>代码示例>>C#>>正文


C# IBusinessObject类代码示例

本文整理汇总了C#中IBusinessObject的典型用法代码示例。如果您正苦于以下问题:C# IBusinessObject类的具体用法?C# IBusinessObject怎么用?C# IBusinessObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IBusinessObject类属于命名空间,在下文中一共展示了IBusinessObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateMapper

 /// <summary>
 /// Creates the appropriate PropertyMapper based on the BusinessObject and propertyName.
 /// </summary>
 /// <param name="businessObject"></param>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 public static IBOPropertyMapper CreateMapper(IBusinessObject businessObject, string propertyName)
 {
     var originalPropertyName = propertyName;
     if (IsReflectiveProp(propertyName))
     {
         IBusinessObject relatedBo = businessObject;
         while (propertyName.Contains(RELATIONSHIP_SEPARATOR))
         {
             //Get the first property name
             string relationshipName = propertyName.Substring(0, propertyName.IndexOf("."));
             propertyName = propertyName.Remove(0, propertyName.IndexOf(".") + 1);
             var newRelatedBo = relatedBo.Relationships.GetRelatedObject(relationshipName);
             if (newRelatedBo == null)
             {
                 var invalidReason = string.Format("The '{0}' relationship of the '{1}' returned null, therefore the '{2}' property could not be accessed.", relationshipName, relatedBo.GetType().Name, propertyName);
                 return new NullBOPropertyMapper(originalPropertyName, invalidReason) { BusinessObject = businessObject };
             }
             relatedBo = newRelatedBo;
         }
         return new ReflectionPropertyMapper(propertyName) { BusinessObject = relatedBo };
     }
     try
     {
         return new BOPropertyMapper(propertyName) { BusinessObject = businessObject };
     }
     catch (InvalidPropertyException)
     {
         //If the BOProp is not found then try a ReflectiveProperty.
         return new ReflectionPropertyMapper(propertyName) { BusinessObject = businessObject };
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:37,代码来源:BOPropMapperFactory.cs

示例2: TransactionalSingleRelationship

 /// <summary>
 /// Constructor for <see cref="TransactionalSingleRelationship"/>
 /// </summary>
 /// <param name="relationship"></param>
 /// <param name="relatedBO"></param>
 protected TransactionalSingleRelationship(IRelationship relationship, IBusinessObject relatedBO)
 {
     if (relatedBO == null) throw new ArgumentNullException("relatedBO");
     _transactionID = Guid.NewGuid().ToString();
     _relationship = relationship;
     _relatedBO = relatedBO;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TransactionalSingleRelationship.cs

示例3: DeleteBusinessObject

 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public void DeleteBusinessObject(IBusinessObject businessObject)
 {
     string message;
     if (CustomConfirmationMessageDelegate != null)
     {
         message = CustomConfirmationMessageDelegate(businessObject);
     }
     else
     {
         message = string.Format("Are you certain you want to delete the object '{0}'", businessObject);
     }
     Confirmer.Confirm(message, delegate(bool confirmed)
         {
             if (!confirmed) return;
             var defaultBODeletor = new DefaultBODeletor();
             try
             {
                 defaultBODeletor.DeleteBusinessObject(businessObject);
             }
             catch (Exception ex)
             {
                 GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error Deleting");
             }
         });
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:29,代码来源:ConfirmingBusinessObjectDeletor.cs

示例4: RelationshipObjectInitialiser

 /// <summary>
 /// Constructor for a new initialiser
 /// </summary>
 /// <param name="parentObject">The parent for the relationship</param>
 /// <param name="relationship">The relationship object</param>
 /// <param name="correspondingRelationshipName">The corresponding
 /// relationship name</param>
 public RelationshipObjectInitialiser(IBusinessObject parentObject, RelationshipDef relationship,
                                      string correspondingRelationshipName)
 {
     _parentObject = parentObject;
     _relationship = relationship;
     _correspondingRelationshipName = correspondingRelationshipName;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:RelationshipObjectInitialiser.cs

示例5: CancelEditsToBusinessObject

 public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:8,代码来源:IDefaultBOEditorForm.cs

示例6: AutorController

 public AutorController(
     IBusinessObject<Autor> bo,
     IMapper<Autor, AutorModel> mapper,
     IMapper<AutorModel, Autor> modelMapper)
 {
     BO = bo;
     Mapper = mapper;
     ModelMapper = modelMapper;
 }
开发者ID:RaphaelChapur,项目名称:UniRitterDemo,代码行数:9,代码来源:AutorController.cs

示例7: GeneroController

 public GeneroController(
     IBusinessObject<Genero> bo,
     IMapper<Genero, GeneroModel> mapper,
     IMapper<GeneroModel, Genero> modelMapper)
 {
     BO = bo;
     Mapper = mapper;
     ModelMapper = modelMapper;
 }
开发者ID:andso,项目名称:UniRitterDemo,代码行数:9,代码来源:GeneroController.cs

示例8: InitialiseObject

        /// <summary>
        /// Initialises the given object
        /// </summary>
        /// <param name="objToInitialise">The object to initialise</param>
        public void InitialiseObject(IBusinessObject objToInitialise)
        {
            BusinessObject newBo = (BusinessObject) objToInitialise;
			foreach (RelPropDef propDef in _relationship.RelKeyDef)
			{
                newBo.SetPropertyValue(propDef.OwnerPropertyName,
                                       _parentObject.GetPropertyValue(propDef.RelatedClassPropName));
            }
            newBo.Relationships.SetRelatedObject(_correspondingRelationshipName, _parentObject);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:RelationshipObjectInitialiser.cs

示例9: BusinessObjectDTO

 /// <summary>
 /// Constructs a DTO for a Business Object.
 /// </summary>
 /// <param name="businessObject"></param>
 public BusinessObjectDTO(IBusinessObject businessObject) {
     ClassDefName = businessObject.ClassDef.ClassName;
     ClassName = businessObject.ClassDef.ClassNameExcludingTypeParameter;
     AssemblyName = businessObject.ClassDef.AssemblyName;
     foreach (IBOProp boProp in businessObject.Props)
     {
         Props[boProp.PropertyName.ToUpper()] = boProp.Value;
     }
     ID = businessObject.ID.ToString();
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:BusinessObjectDTO.cs

示例10: TestUpdate

        internal static void TestUpdate(IBusinessObject busObject, object newValue, string columnName)
        {
            ObjectStateEntry stateEntry;
            BsoArchiveEntities.Current.ObjectStateManager.TryGetObjectStateEntry(busObject, out stateEntry);

            var createdProps = stateEntry.CurrentValues.DataRecordInfo.FieldMetadata;

            var prop = createdProps.FirstOrDefault(p => p.FieldType.Name.ToUpper() == columnName.ToUpper());
            stateEntry.CurrentValues.SetValue(prop.Ordinal, newValue);
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:10,代码来源:BsoArchiveEntities.cs

示例11: BusObjDeleteException

 /// <summary>
 /// Constructor to initialise the exception with details regarding the
 /// object whose record was deleted
 /// </summary>
 /// <param name="bo">The business object in question</param>
 /// <param name="message">Additional err message</param>
 public BusObjDeleteException(IBusinessObject bo, string message):
     base(String.IsNullOrEmpty(message) ? string.Format(
         "You cannot delete the '{0}', as the IsDeletable is set to false for the object. " +
         "ObjectID: {1}, also identified as {2}",
         bo.ClassDef.ClassName, bo.ID, bo) : message, 
         !String.IsNullOrEmpty(message) ? new Exception(
             string.Format(
                 "You cannot delete the '{0}', as the IsDeletable is set to false for the object. " +
                 "ObjectID: {1}, also identified as {2}",
                 bo.ClassDef.ClassName, bo.ID, bo)) : null)
 {
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:18,代码来源:BusObjDeleteException.cs

示例12: BusinessObjectLastUpdatePropertiesLog

 ///<summary>
 /// This constructor initialises this update log with the BusinessObject to be updated.
 /// This businessobject is then searched for the default UserLastUpdated and DateLastUpdated properties 
 /// that are to be updated when the BusinessObject is updated.
 ///</summary>
 ///<param name="businessObject">The BusinessObject to be updated</param>
 public BusinessObjectLastUpdatePropertiesLog(IBusinessObject businessObject)
 {
     IBOPropCol boPropCol = businessObject.Props;
     string propName = "UserLastUpdated";
     if (boPropCol.Contains(propName))
     {
         _userLastUpdatedBoProp = boPropCol[propName];
     }
     propName = "DateLastUpdated";
     if (boPropCol.Contains(propName))
     {
         _dateLastUpdatedBoProp = boPropCol[propName];
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:BusinessObjectLastUpdatePropertiesLog.cs

示例13: DeleteBusinessObject

 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public virtual void DeleteBusinessObject(IBusinessObject businessObject)
 {
     try
     {
         businessObject.MarkForDelete();
         var committer = BORegistry.DataAccessor.CreateTransactionCommitter();
         committer.AddBusinessObject(businessObject);
         committer.CommitTransaction();
     }
     catch (Exception)
     {
         businessObject.CancelEdits();
         throw;
     }
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:19,代码来源:DefaultBODeletor.cs

示例14: UpdateObject

        internal static void UpdateObject(IBusinessObject busObject, object newValue, string columnName)
        {
            ObjectStateEntry stateEntry;
            BsoArchiveEntities.Current.ObjectStateManager.TryGetObjectStateEntry(busObject, out stateEntry);

            var createdProps = stateEntry.CurrentValues.DataRecordInfo.FieldMetadata;

            var prop = createdProps.FirstOrDefault(p => p.FieldType.Name.ToUpper() == columnName.ToUpper());

            if (prop.FieldType == null)
                return;

            var value = EFUtility.MapType(newValue, prop.FieldType.TypeUsage.EdmType);

            stateEntry.CurrentValues.SetValue(prop.Ordinal, value);
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:16,代码来源:BsoArchiveEntities.cs

示例15: AddBusinessObject

 ///<summary>
 /// Add an object of type business object to the transaction.
 /// The DBTransactionCommiter wraps this Business Object in the
 /// appropriate Transactional Business Object
 ///</summary>
 ///<param name="businessObject"></param>
 public void AddBusinessObject(IBusinessObject businessObject)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor = GetDataAccessorForType(businessObject.GetType());
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     } else
     {
         IDataAccessor dataAccessorToUseForType = GetDataAccessorForType(businessObject.GetType());
         if (dataAccessorToUseForType != _myDataAccessor)
         {
             throw new HabaneroDeveloperException("A problem occurred while trying to save, please see log for details", string.Format("A BusinessObject of type {0} was added to a TransactionCommitterMultiSource which has been set up with a different source to this type.", businessObject.GetType().FullName));
         }
     }
     _transactionCommitter.AddBusinessObject(businessObject);
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:22,代码来源:TransactionCommitterMultiSource.cs


注:本文中的IBusinessObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。