Skip to content

ComplexCollection how to configure HasMaxLength etc for the properties? #37140

@SpaceOgre

Description

@SpaceOgre

Question

I just upgraded to EF Core 10 and was planing on replacing some of my OwnsMany with ComplexCollection but I can't figure out how to configure the properties with HasMaxLength for ComplexCollection.

For ComplexProperty there is no problem.

Your code

//This gives error as HasMaxLength does not exist for the ComplexPropertyBuilder
builder.ComplexCollection(e => e.CareNeedAnswers, b => b.Property(e => e.Answer).HasMaxLength(500));

//This works as HasMaxLength exist for ComplexTypePropertyBuilder
builder.ComplexProperty(e => e.CareNeedAnswer, b => b.Property(e => e.Answer).HasMaxLength(500));

Stack traces


Verbose output


EF Core version

10.0.0

Database provider

No response

Target framework

.Net 10

Operating system

No response

IDE

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions