本文整理汇总了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 };
}
}
示例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;
}
示例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");
}
});
}
示例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;
}
示例5: CancelEditsToBusinessObject
public void CancelEditsToBusinessObject(IBusinessObject bo)
{
bo.CancelEdits();
if (bo.Status.IsNew)
{
bo.MarkForDelete();
}
}
示例6: AutorController
public AutorController(
IBusinessObject<Autor> bo,
IMapper<Autor, AutorModel> mapper,
IMapper<AutorModel, Autor> modelMapper)
{
BO = bo;
Mapper = mapper;
ModelMapper = modelMapper;
}
示例7: GeneroController
public GeneroController(
IBusinessObject<Genero> bo,
IMapper<Genero, GeneroModel> mapper,
IMapper<GeneroModel, Genero> modelMapper)
{
BO = bo;
Mapper = mapper;
ModelMapper = modelMapper;
}
示例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);
}
示例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();
}
示例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);
}
示例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)
{
}
示例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];
}
}
示例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;
}
}
示例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);
}
示例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);
}