Skip to content

Commit

Permalink
finally (did not test all after model changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilLord666 committed Nov 2, 2024
1 parent b2218c5 commit ff9fd86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,21 @@ edgedb ui

Once you loaded project you could use it in current application:

1. Add proper connection string in the database section in `appsettings.Development.json`config file:
1. Add proper Project Name in `appsettings.Development.json`config file:
```json
"Application": {
"Database": {
"ConnStr": "edgedb://edgedb:VcJjK6blkKAV2MUTdJXzLPvS@localhost:10702/edgedb"
}
"ProjectName": "Wissance_WeatherControl"
}
}
```

configuration string must have the following scheme: `edgedb://user:password@host:port/database`
you could see your project credential on `Windows` machine in a directory:
`%USER_PROFILE%\AppData\Local\EdgeDB\config\credentials`
See how configuration works via project Name [here](https://github.com/Wissance/EdgeDb.Net.Configurator)

This package build connnection string using following scheme: `edgedb://user:password@host:port/database`
you could see your project credential on:
* `Windows` machine in a directory: `%USER_PROFILE%\AppData\Local\EdgeDB\config\credentials`
* `Linux` machine in a directory `$HOME/.config/edgedb/credential`

#### 4.2 REST API With Edge DB

Expand All @@ -360,7 +363,7 @@ All controllers are located in a folder `Controllers`, just look how simply look
```csharp
namespace Wissance.WeatherControl.WebApi.V2.Controllers
{
public class MeasurementController : BasicCrudController<MeasurementDto, MeasurementEntity, Guid>
public class MeasurementController : BasicCrudController<MeasurementDto, MeasurementEntity, Guid, , MeasureUnitFilterable>
{
public MeasurementController(EdgeDBClient edgeDbClient)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private string GetSortOption(SortOption sorting = null)

private readonly IDictionary<ModelType, string> _bulkInsertQuery = new Dictionary<ModelType, string>()
{
{ ModelType.Measurement, @"FOR x IN {{json_array_unpack(<json>$data) }} UNION (INSERT Measurement {{id:=<uuid>x['id'], SampleDate:=<datetime>x['SampleDate'], Value:=to_decimal(<str>x['Value']), Unit:=(SELECT MeasureUnit {{id}} FILTER .id = <uuid>x['MeasureUnitId']), Sensor:=(SELECT Sensor {{id}} FILTER .id = <uuid>x['SensorId'] LIMIT 1) }});"}
{ ModelType.Measurement, @"FOR x IN {{json_array_unpack(<json>$data) }} UNION (INSERT Measurement {{id:=<uuid>x['id'], SampleDate:=<datetime>x['SampleDate'], Value:=to_decimal(<str>x['Value']), Sensor:=(SELECT Sensor {{id}} FILTER .id = <uuid>x['SensorId'] LIMIT 1) }});"}
};

private readonly IDictionary<ModelType, string> _updateQuery = new Dictionary<ModelType, string>()
Expand Down

0 comments on commit ff9fd86

Please sign in to comment.