Skip to content

How to use string functions like Contains or StartWith with string backed StronglyTypedId for Like queries in ef core  #128

@amit-srivastava-007

Description

@amit-srivastava-007

Hello, I'm having a situation where a StronglyTypedIdBackingType.String ids need to be used in a ef core query with StartsWith. Currently, I'm not seeing any string function available for such ids. Please guide me how to use it.

I'm using v1.0.0-beta06 of the package

Example:

let's say abc/efg/mnpxyz is a value of an Id field stored as hierarchy for city/ward/building for Office entity.

public class Office
{
  [StronglyTypedId(backingType: StronglyTypedIdBackingType.String)]
  public partial struct Id { }
}

I want to write query

Office.Where(x=>x.Id.StartsWith("abc").Select(x=>x);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions