{"record":{"id":"dc45b69ff346319e","repo":"dotnet/efcore","slug":"the-property-property-on-type-type-cannot","errorCode":null,"errorMessage":"The property '{property}' on type '{type}' cannot be configured as not auto-loaded. The Cosmos provider doesn't support partial property loading.","messagePattern":"The property '(.+?)' on type '(.+?)' cannot be configured as not auto-loaded\\. The Cosmos provider doesn't support partial property loading\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":64,"sourceCode":"        ValidateDiscriminatorMappings(entityType, logger);\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected override void ValidateAutoLoaded(\n        IProperty property,\n        ITypeBase structuralType,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {\n        base.ValidateAutoLoaded(property, structuralType, logger);\n\n        if (!property.IsAutoLoaded)\n        {\n            throw new InvalidOperationException(\n                CosmosStrings.AutoLoadedCosmosProperty(property.Name, structuralType.DisplayName()));\n        }\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected virtual void ValidateSharedContainerCompatibility(\n        IModel model,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {\n        // All entity types mapped to a single container must have the same container-level settings, most notably partition keys.\n        var containers = new Dictionary<string, List<IEntityType>>();\n        foreach (var entityType in model.GetEntityTypes().Where(et => et.FindPrimaryKey() != null))\n        {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L46-L82","documentation":"CosmosModelValidator.ValidateAutoLoaded throws InvalidOperationException(CosmosStrings.AutoLoadedCosmosProperty) when a property is configured as NOT auto-loaded. The Cosmos provider always loads the entire document (no partial property loading / column pruning), so every property must remain auto-loaded. Marking a property as lazy/explicit-loaded (IsAutoLoaded(false)) is incompatible with Cosmos and is rejected at model validation time.","triggerScenarios":"Calling property.IsAutoLoaded(false) (or AutoLoaded(false) on the builder) on an entity mapped to a Cosmos container; sharing an entity configuration between a relational provider (where partial loading is allowed) and Cosmos; upgrading EF Core where the auto-load concept was introduced and existing entities get a non-default value.","commonSituations":"Reusing model configuration across providers where one disables auto-loading for a relational provider; misconfiguring a large property as lazy-loaded on a Cosmos entity; conventions or attributes that set auto-load to false applied to Cosmos entities.","solutions":["Do not set IsAutoLoaded(false) on properties of entities mapped to Cosmos; leave it at the default (true).","When sharing configuration across providers, branch on the provider: only apply AutoLoaded(false) when not using Cosmos.","If you are trying to avoid loading large fields, consider value converters or splitting the entity into a separate owned/embedded type rather than disabling auto-load.","Audit your configuration pipeline (conventions, attributes, IModelConfiguration) for any source that sets auto-load to false and exclude Cosmos entities."],"exampleFix":"// before - throws on Cosmos at model validation\nentity.Property(e => e.LargeBlob).AutoLoaded(false);\n\n// after - do not disable auto-load for Cosmos-mapped entities\n// (remove the line, or branch on provider)\nif (!options.Extensions.OfType<CosmosOptionsExtension>().Any())\n{\n    entity.Property(e => e.LargeBlob).AutoLoaded(false);\n}","handlingStrategy":"validation","validationCode":"// Branch Cosmos-specific configuration so AutoLoaded(false) is never applied to Cosmos entities.\nbool isCosmos = options.Extensions.OfType<CosmosOptionsExtension>().Any();\nif (!isCosmos)\n{\n    entity.Property(e => e.LargeBlob).AutoLoaded(false);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call AutoLoaded(false) on properties of Cosmos-mapped entities.","When sharing configuration across providers, branch on whether Cosmos is in use.","Audit conventions/attributes that disable auto-load so they skip Cosmos entities.","Prefer value converters or splitting into owned/embedded types to avoid loading large fields."],"tags":["ef-core","cosmos","model-validation","auto-loaded","configuration"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}