I'll describe my requirements, then my problem.
The libraries I'm using are:
using System;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
I want to store two fields per record in my Firebase RTDB. One is an ID (to function as the Primary Key), and the other is a Name. To do this, I created a class with these two properties as so:
public class Players
{
public string ID { get; set; }
public string Name { get; set; }
}
In order to insert data into my RTDB, I use the following code. Players in this context is the class mentioned above.
Players user = new Players();
Console.WriteLine("Enter Player Tag");
user.ID = Console.ReadLine();
Console.WriteLine("Enter Player Tag");
user.Name = Console.ReadLine();
var set = client.Set("PlayerTag/" + user.ID, user.Name);
I have already configured client with my RTDB secret and BasePath.
This is where my issue arises. When I insert data, the program runs smoothly. It takes whatever data I give it and feeds it to the RTDB. When I check Firebase, I can find all the data I added. But when I try to retrieve data from the RTDB, it throws me the error.
So, here's the get()
method:
var set = client.Get("PlayerTag/" + user.ID);
Players getuser = set.ResultAs<Players>(); //error pops up here
Console.WriteLine(getuser.Name);
So, what happens is, basically, it highlights Players in the above code, and then throws me this error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'
So, my question is: if it recognised the Player
class when I run the Set()
method, why does it return an error when I run the Get()
method?