[CONNECT .NET] ECQuery

I'd like to compose a query to use with DgnECManager.FindInstances using an ECQuery.  Unfortunately, the MstnPlatformNet documentation continues to ignore that class.  The SDK examples help little, using the catch-all SelectAllProperties.

ECQuery query = new ECQuery(GetSearchClasses());
query.SelectClause.SelectAllProperties = true;

How can one write a query, say, to select Item instance properties having a certain value?   That is, I'd like to know about ECQuery.SelectClause. If Item Types supported SQL, I would write something like...

SELECT * FROM MyItemType
WHERE ID='abc'

Since DgnECManager.FindInstances returns IQueryable<> it's tempting to ignore the MstnPlatformNet  API and use LINQ to compose a query.  Which approach would you make your strategy?

Parents
  • Hi Jon,

    I apologize for joining this thread late.

    About .NET ECQuery documentation: I am trying to get whole bunch of .NET ECFramework documentation in U13 SDK. Robert Hook will let you know accordingly.

    About using .NET ECQuery: 

    In ECQuery.SelectClause, 

    You call tell which properties you want: query.SelectClause.SelectedProperties.Add(..

    You can tell what relationships you want w.r.t. searchClasses as:

    QueryRelatedClassSpecifier relClassSpec = new QueryRelatedClassSpecifier (m_relationshipClass, false, ECI.RelatedInstanceDirection.Forward, m_targetClass, false);
    RelatedCriterion relatedPropertyCriterion = new RelatedCriterion (relClassSpec);

    query.SelectClause.SelectedRelatedInstances.Add (new RelatedInstanceSelectCriteria (relClassSpec, true));

    Please let me know if you are looking for something else.

    Thanks,

    Mangesh


    This is a test

Reply
  • Hi Jon,

    I apologize for joining this thread late.

    About .NET ECQuery documentation: I am trying to get whole bunch of .NET ECFramework documentation in U13 SDK. Robert Hook will let you know accordingly.

    About using .NET ECQuery: 

    In ECQuery.SelectClause, 

    You call tell which properties you want: query.SelectClause.SelectedProperties.Add(..

    You can tell what relationships you want w.r.t. searchClasses as:

    QueryRelatedClassSpecifier relClassSpec = new QueryRelatedClassSpecifier (m_relationshipClass, false, ECI.RelatedInstanceDirection.Forward, m_targetClass, false);
    RelatedCriterion relatedPropertyCriterion = new RelatedCriterion (relClassSpec);

    query.SelectClause.SelectedRelatedInstances.Add (new RelatedInstanceSelectCriteria (relClassSpec, true));

    Please let me know if you are looking for something else.

    Thanks,

    Mangesh


    This is a test

Children