using DevAwesome.WebDataBridge;
using DevAwesome.WebDataBridge.StorageProviders;
public class MyClass{
[WebDataBridgeRegistration]
public void SoundLibrary( ) {
// The service name will act as the base of your URL... http://localhost/data/SoundLibrary/
// There are two types of URLS. cached & fresh http://localhost/data/cache/SoundLibrary/ AND http://localhost/data/fresh/SoundLibrary/
// By default cached data will be returned http://localhost/data/SoundLibrary/ is the same as using http://localhost/data/cache/SoundLibrary/
string ServiceName = "SoundLibrary";
WebDataBridge.Instance
// this is where we register an endpoint. this example would result in a url of http://localhost/data/SoundLibrary/UploadableFileTypes
// adding an endpoint requires a service name, endpoint name, description and finally a function capable of getting or creating the data you want to output
// all data gets output as json.
// this example gets output as "*.mp3;*.wav"
.AddEndPoint( ServiceName, "UploadableFileTypes", "Uploadable File Types",
( ) => { return "*.mp3;*.wav"; } )
.AddEndPoint( ServiceName, "Categories.List", "Sound Category List (SELECT)",
( ) => new SoundCategoryRepository( ).All.Select( x => new { value = x.Id, key = x.CategoryName, descr = x.CategoryDescription } ) )
// this is where we register an endpoint. this example would result in a url of http://localhost/data/SoundLibrary/Categories and output a list of json objects.
.AddEndPoint<RedisStorageProvider>( ServiceName, "Categories", "Sound Category List (RAW)",( ) => new SoundCategoryRepository( ).All.Select( x => new { x.Id, x.CategoryName, x.CategoryDescription } ) );}}