-
I received this question as an email:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This can be solved on either the FileMaker side or the C# side. I have done both, but you can choose the best approach for you. FileMaker Based SolutionSince it is best practice to access layouts designed for data api consumption directly, it can often make sense to drop these layouts into their own file, and add external file references to other files for data. This allows you to use that file as the entry point to your data, and can easily branch out across multiple files using FileMaker File references. This approach works very well, and its supported by using built-in FileMaker features. That means you don't take on any extra maintenance work to do this. C# Based solution with DIThe samples in the readme throw a single Client into the DI container, assuming you've used the above solution to connect to multiple files; however, this can be wrapped into a specific class that itself is added to DI. public class DbOneWrapper
{
private readonly FMData.FileMakerRestClient _client;
public DbOneWrapper(IHttpClientFactory factory)
{
var conInfo = new FMData.ConnectionInfo { Server = ... };
_client = new FMData.FileMakerRestClient(factory.CreateClient(), conInfo);
}
public TableOne[] GetTableOne()
{
_client.FindAsync(...);
}
}
// startup
Services.AddHttpClient();
Services.AddSingleton<DbOneWrapper>(); Then repeat as necessary for each different database you want to connect with. I'm sure there are other ways to solve this as well. |
Beta Was this translation helpful? Give feedback.
This can be solved on either the FileMaker side or the C# side. I have done both, but you can choose the best approach for you.
FileMaker Based Solution
Since it is best practice to access layouts designed for data api consumption directly, it can often make sense to drop these layouts into their own file, and add external file references to other files for data. This allows you to use that file as the entry point to your data, and can easily branch out across multiple files using FileMaker File references.
This approach works very well, and its supported by using built-in FileMaker features. That means you don't take on any extra maintenance work to do this.
C# Based solution with DI
The…