-
Hi All, I'm currently building a C# WebAssembly application using the supabase-csharp library. I have been getting this error every time I try to get data from a table. I have been debugging for a while now and I'm still scratching my head, was wondering if anyone might be able to point me in the right direction. I'm not sure what I'm doing wrong.
The method that is throwing the error: private async Task<Report[]> GetReportsAsync()
{
IsLoading = true;
try
{
var reports = await supabase.Postgrest.Table<Report>().Get();
return reports.Models.ToArray();
}
catch (Exception ex) { exceptionHandler.Handle(ex); }
finally { IsLoading = false; }
return Array.Empty<Report>();
} This is the class I am trying to retrieve, I have followed these examples. However, mine does not seem to work. using Postgrest.Attributes;
using Postgrest.Models;
using Supabase.Gotrue;
namespace SimonApp.Data
{
[Table("reports")]
public class Report : BaseModel
{
[PrimaryKey("id")]
public int Id { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Reference(typeof(Room), propertyName: "room_id")]
public Room Room { get; set; } = default!;
[Column("description")]
public string Description { get; set; } = default!;
[Reference(typeof(ServiceCategory), propertyName: "service_category_id")]
public ServiceCategory ServiceCategory { get; set; } = default!;
[Column("resolve_by_date")]
public DateTime ResolveBy { get; set; }
[Reference(typeof(User), propertyName: "user_uuid")]
public User? User { get; set; }
[Reference(typeof(ReportSeries), propertyName: "series_id")]
public ReportSeries Series { get; set; } = default!;
[Reference(typeof(ReportEvent))]
public List<ReportEvent> Events { get; set; } = default!;
}
} Any help would be greatly appreciated! :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Does the |
Beta Was this translation helpful? Give feedback.
-
Thanks again! I haven't fully implemented a user sign-up yet. However, I've taken your suggestion and setup a |
Beta Was this translation helpful? Give feedback.
Ok, so I found the source of the issue! I had created a reference to
Supabase.Gotrue.User
, which does not derive from theBaseModel
class.What would be the best practice method of storing a reference to a user inside a table?