-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/md7319/cosmosdbusage main #125
base: main
Are you sure you want to change the base?
Conversation
Fixes #106 |
@@ -105,6 +109,7 @@ private static Orcanode FindOrCreateOrcanodeByDataplicitySerial(DbSet<Orcanode> | |||
connectionStatus = OrcanodeOnlineStatus.Absent; | |||
Orcanode newNode = CreateOrcanode(nodeList); | |||
newNode.DataplicitySerial = serial; | |||
newNode.year= DateTime.UtcNow.Year.ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orcanodes should not have a year, only events.
@@ -430,7 +436,7 @@ public async static Task UpdateOrcasoundDataAsync(OrcanodeMonitorContext context | |||
} | |||
|
|||
// Create a list to track what nodes are no longer returned. | |||
var unfoundList = context.Orcanodes.ToList(); | |||
var unfoundList = context.Orcanodes!=null ?context.Orcanodes.ToList():null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var unfoundList = context.Orcanodes!=null ?context.Orcanodes.ToList():null; | |
var unfoundList = context.Orcanodes?.ToList(); |
@@ -542,6 +549,31 @@ public async static Task UpdateOrcasoundDataAsync(OrcanodeMonitorContext context | |||
{ | |||
node.OrcasoundVisible = visible.GetBoolean(); | |||
} | |||
/* if (attributes.TryGetProperty("bucket_region", out var bucketregion)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't have commented out code
modelBuilder.Entity<Orcanode>() | ||
.ToContainer("Orcanode") | ||
.Property(item => item.ID); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.WithMany() | ||
.HasForeignKey(item=>item.OrcanodeId); | ||
|
||
/*modelBuilder.Entity<OrcanodeEvent>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't have commented out code
@@ -69,6 +69,7 @@ public OrcanodeEvent(Orcanode node, string type, string value, DateTime timestam | |||
Value = value; | |||
DateTimeUtc = timestamp; | |||
OrcanodeId = node.ID; | |||
year = DateTime.UtcNow.Year.ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
year = DateTime.UtcNow.Year.ToString(); | |
Year = DateTime.UtcNow.Year.ToString(); |
capitalize for consistency with the existing fields
|
||
// Navigation property that uses OrcanodeId. | ||
public virtual Orcanode Orcanode { get; set; } | ||
|
||
public DateTime DateTimeUtc { get; set; } | ||
|
||
public string year { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public string year { get; set; } | |
public string Year { get; set; } |
Can this be an integer or must it be a string?
And if this is a partition key, add a comment saying so.
@@ -6,6 +6,7 @@ | |||
using System.Text.Json.Serialization; | |||
using System.Xml.Linq; | |||
using Microsoft.IdentityModel.Tokens; | |||
using Microsoft.VisualBasic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is VisualBasic needed for?
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert adding this file.
.user" files should not be checked in.
(I will add that suffix to .gitignore.)
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// First see if an environment variable specifies a connection string. | ||
var connection = Environment.GetEnvironmentVariable("AZURE_SQL_CONNECTIONSTRING"); | ||
//var connection = Environment.GetEnvironmentVariable("AZURE_SQL_CONNECTIONSTRING"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not have commented out code
@md7319 this is great progress, thanks! see comments, mostly stylistic. |
Added logic to use Cosmos DB as storage for OrcanodeMonitor data .