{"record":{"id":"a7af6b84d28d680d","repo":"aspnetboilerplate/aspnetboilerplate","slug":"0-is-a-key-field-and-cannot-be-ignored","errorCode":null,"errorMessage":"'{0}' is a key field and cannot be ignored.","messagePattern":"'(.+?)' is a key field and cannot be ignored\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Abp.Dapper/Dapper-Extensions/Mapper/MemberMap.cs","lineNumber":183,"sourceCode":"            }\n\n            if (!string.IsNullOrEmpty(SequenceName) && keyType != KeyType.SequenceIdentity)\n            {\n                throw new ArgumentException(string.Format(\"'{0}' cannot be made a key field. \", Name));\n            }\n\n            KeyType = keyType;\n            return this;\n        }\n\n        /// <summary>\n        /// Fluently sets the ignore status of the property.\n        /// </summary>\n        public MemberMap Ignore()\n        {\n            if (KeyType != KeyType.NotAKey && KeyType != KeyType.SlapperIdentifierKey)\n            {\n                throw new ArgumentException(string.Format(\"'{0}' is a key field and cannot be ignored.\", Name));\n            }\n\n            Ignored = true;\n            return this;\n        }\n\n        /// <summary>\n        /// Fluently sets the read-only status of the property.\n        /// </summary>\n        public MemberMap ReadOnly()\n        {\n            if (KeyType != KeyType.NotAKey && KeyType != KeyType.SlapperIdentifierKey)\n            {\n                throw new ArgumentException(string.Format(\"'{0}' is a key field and cannot be marked readonly.\", Name));\n            }\n\n            IsReadOnly = true;\n            return this;","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/aspnetboilerplate/aspnetboilerplate/blob/2323c13a152aa0ebfb37af3830f687d7f5b53795/src/Abp.Dapper/Dapper-Extensions/Mapper/MemberMap.cs#L165-L201","documentation":"Guard in MemberMap.Ignore(): the member {0} currently has a KeyType other than NotAKey and SlapperIdentifierKey, meaning it is an active mapped key. ABP Dapper forbids ignoring a key field because doing so would silently drop it from generated SQL, so the fluent Ignore() call is aborted with this ArgumentException.","triggerScenarios":"Thrown at src/Abp.Dapper/Dapper-Extensions/Mapper/MemberMap.cs:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clear or change the key assignment on this member before calling Ignore(), so its KeyType is NotAKey.","Ignore a different, non-key property instead of the key field {0}.","If the member should no longer be a key, restructure the ClassMap so the key is mapped on another property."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2323c13a152aa0ebfb37af3830f687d7f5b53795","analyzedAt":"2026-09-08T08:00:50.638Z","contentChangedAt":"2026-09-08T08:00:50.638Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}