File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog for ` FSharp.CosmosDb `
22
3+ ## [ 1.2.1] - Unreleased
4+
5+ ### Fixes
6+
7+ - Fixing #69 by finding a property using conventions first, before raising an error
8+
39## [ 1.2.0] - 2022-08-22
410
511### Added
Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ let getIdFieldName<'T> (item: 'T) =
1111
1212 match idAttr with
1313 | Some attr -> attr.GetValue( item) .ToString()
14- | None -> " id"
14+ | None ->
15+ let property = item.GetType() .GetProperties() |> Array.tryFind( fun p -> p.Name.Equals( " id" , StringComparison.InvariantCultureIgnoreCase))
16+ match property with
17+ | Some property -> property.GetValue( item) .ToString()
18+ | None -> failwith " Unable to determine the id field of the type. Either use the IdAttribute or have a field named Id"
1519
1620let getPartitionKeyValue < 'T > ( single : 'T ) =
1721 let partitionKey = PartitionKeyAttributeTools.findPartitionKey< 'T> ()
You can’t perform that action at this time.
0 commit comments