XCRM: Leads and opportunities

XAF Team Blog
03 October 2008

Domain Components (DC) is in maintenance mode and we do not recommend its use in new software projects.

This post is one in a series about our work on Domain Components (DC) framework and related component libraries. I’m just describing what we are working on, what problems we are facing and what results we've got so far.

A Lead is not directly linked to a Contact or Account. It can be converted into an Account, Contact or Opportunity later. I’ll just capture the fact that the Lead class exists and may have some basic info:

public void LeadsRelationships() {
    ILead romanFromDx = ObjectSpace.CreateObject<ILead>();
    romanFromDx.FirstName = "Roman";
    romanFromDx.LastName = "Eremin";
    romanFromDx.CompanyName = "DevExpress";
public interface ILead {
    string FirstName { get; set; }
    string LastName { get; set; }
    string CompanyName { get; set; }

At this point, I’m not sure that the ILead should be inherited from the IPerson. So, I've just added the FirstName and LastName properties, and made a note to resolve this problem later.

An Opportunity is a more probable possibility for business. It is related to an Account (who you want to sell to) and Product (what you want to sell). Simple CRM systems do not track products and prices, so I will leave them out in our CRM app. Here is the test for Opportunities:

public void OpportunityAccountRelationships() {
    IAccount dx = ObjectSpace.CreateObject<IAccount>();
    dx.Name = "DevExpress";
    IOpportunity sellComponents = ObjectSpace.CreateObject<IOpportunity>();
    sellComponents.Name = "Sell some third-party components to DX";
    sellComponents.Account = dx;
    Assert.IsTrue(Enumerator.Exists<IOpportunity>(dx.Opportunities, sellComponents));

To make this test pass I need the following:

public interface IOpportunity {
    string Name { get; set; }
    IAccount Account { get; set; }
public interface IAccount {
    IList<IOpportunity> Opportunities { get; }

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.