# Class ServiceConfigRepository

Namespace
  adas_core.Infrastructure.Repositories

Assembly
  adas-core.Infrastructure.dll

Represents a MongoDB repository for ServiceConfig entities, implementing the IServiceConfigRepository contract to provide data access operations.

    public class ServiceConfigRepository : MongoRepository<ServiceConfig>, IServiceConfigRepository, IMongoRepository<ServiceConfig>

Inheritance
  object
  MongoRepository<ServiceConfig>
  ServiceConfigRepository

Implements
  IServiceConfigRepository
  IMongoRepository<ServiceConfig>

Inherited Members
  MongoRepository<ServiceConfig>.Db
  MongoRepository<ServiceConfig>.Collection
  MongoRepository<ServiceConfig>.InsertOneAsync(ServiceConfig)
  MongoRepository<ServiceConfig>.UpdateOneAsync(ObjectId, ServiceConfig)
  MongoRepository<ServiceConfig>.DeleteAsync(ObjectId)
  MongoRepository<ServiceConfig>.CreateIndexes()
  MongoRepository<ServiceConfig>.InsertInitialLoad()
  MongoRepository<ServiceConfig>.InsertManyAsync(List<ServiceConfig>)
  MongoRepository<ServiceConfig>.UpdateManyObjectIdAsync(string, ObjectId, ObjectId)
  MongoRepository<ServiceConfig>.DeleteAsync(string)
  MongoRepository<ServiceConfig>.CollectionExists(string)
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### ServiceConfigRepository(IOptions<ApiSettings>, IMongoDatabase)

    public ServiceConfigRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database)

#### Parameters

`apiSettings` IOptions<ApiSettings>
`database` IMongoDatabase

## Methods

### FindById(ObjectId)

Asynchronously retrieves a ServiceConfig from the collection that matches the specified identifier, returning null when no matching document exists.

    public Task<ServiceConfig?> FindById(ObjectId oid)

#### Parameters

`oid` ObjectId

  The MongoDB.Bson.ObjectId of the ServiceConfig to locate.

#### Returns

Task<ServiceConfig>

  A ServiceConfig instance if a document with the given identifier is found; otherwise, null.

### FindById(string)

Finds a ServiceConfig document by matching its string identifier (`StrId`) with the provided value. Returns `null` when no matching configuration exists in the collection.

    public Task<ServiceConfig?> FindById(string id)

#### Parameters

`id` string

  The string identifier used to look up the service configuration.

#### Returns

Task<ServiceConfig>

  A task that represents the asynchronous operation, containing the matching ServiceConfig or `null` if not found.

### GetCollectionName()

Retrieves the service configuration collection name from API settings, falling back to the default "service_config" when no value is configured.

    public override string GetCollectionName()

#### Returns

string

  The configured service collection name, or the default "service_config" when the API setting is null.