FAQ Database Discussion Community

How do I fix a DivideByZeroException

I am using DevExpress XAF Framework. I have a Class with a lot of Persistent Alias Attributes that does some math on the properties. Here is an example of my code: [PersistentAlias("ShortTermDebt + LongTermDebt / EquityTotal")] public decimal DebtEquity { get { return decimal.Parse(EvaluateAlias("DebtEquity").ToString()); } } I have tried setting...

Simpler alternative for accessing master object from nested listview on XAF

I want to know if there is simple and clear method other than this for accessing master object from a nested listview controller. ((PropertyCollectionSource)((ListView)View).CollectionSource).MasterObject Do I have to write this in everywhere where i need to access master object? I think this is not an elegant way and looks so...

Setting a value to a field in XPO

If I want to assign a default value to a BO's field while saving it (in my Controller class), How can I achieve this using C# and xaf? Which events are relevant?

How do I construct a DbContext from an ObjectContext?

I am trying to create a constructor for my Context class from an ObjectContext. I want to do this because I am using DevExpress xaf which makes it easy to get hold of the ObjectContext from inside a view. The MSDN help is here but it does not include an...

Getting AllowEdit to default to true for a listview with XAF+EF+Generics

Generics aren't officially supported in XAF. However I use them and love them. [DomainComponent] Public abstract class SalesHeader<TSalesLine> : BasicBO where TSalesLine : SalesProductTransactionLine { public virtual BindingList<TSalesLine> Lines { get; set; } } [DomainComponent] public class SalesOrder : SalesHeader<SalesOrderLine>, ISalesHeader<SalesOrderLine> { public SalesOrder() { Lines = new BindingList<SalesOrderLine>(); ContactPerson...

XAF CollectionsEditMode

When in Application.CollectionsEditMode=Edit mode, nested aggregated child object lists behave as we needed, not saving anything to DB until parent object's save action executes. But when using Application.CollectionsEditMode=View and setting required DetailView.CollectionsEditMode=Edit from platform's model this behaviour changes and when saving a child, master object is saved too, without waiting...