forked from dotnet/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyPropertyModel.cs
More file actions
33 lines (28 loc) · 1.48 KB
/
Copy pathKeyPropertyModel.cs
File metadata and controls
33 lines (28 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.DiagnosticIds;
namespace Microsoft.Extensions.VectorData.ProviderServices;
/// <summary>
/// Represents a key property on a vector store record.
/// This is an internal support type meant for use by providers only and not by applications.
/// </summary>
[Experimental(DiagnosticIds.Experiments.VectorDataPropertyModel, UrlFormat = DiagnosticIds.UrlFormat)]
public class KeyPropertyModel(string modelName, Type type) : PropertyModel(modelName, type)
{
/// <summary>
/// Gets or sets a value indicating whether this key property's value is auto-generated or not.
/// </summary>
public bool IsAutoGenerated { get; set; }
/// <summary>
/// Gets or sets the name that the JSON serializer will produce for this key property.
/// This is needed for providers that use an external JSON serializer combined with a reserved key storage name
/// (e.g. CosmosDB NoSQL uses "id"): the serializer produces a JSON object with the policy-transformed name, and
/// the provider needs to find and replace it with the reserved storage name.
/// </summary>
public string? SerializedKeyName { get; set; }
/// <inheritdoc/>
public override string ToString()
=> $"{ModelName} (Key, {Type.Name}{(IsAutoGenerated ? ", auto-generated" : string.Empty)})";
}