AsyncData 1.0.0
dotnet add package AsyncData --version 1.0.0
NuGet\Install-Package AsyncData -Version 1.0.0
<PackageReference Include="AsyncData" Version="1.0.0" />
<PackageVersion Include="AsyncData" Version="1.0.0" />
<PackageReference Include="AsyncData" />
paket add AsyncData --version 1.0.0
#r "nuget: AsyncData, 1.0.0"
#:package AsyncData@1.0.0
#addin nuget:?package=AsyncData&version=1.0.0
#tool nuget:?package=AsyncData&version=1.0.0
format this into a readme.md file
AsyncData System Usage Guide Class Definitions and Indexing Dealer
public class Dealer : AsyncDocument<Dealer> { public override string GetCollectionName() ⇒ "dealers"; public AsyncDocumentLinkList<Vehicle> VehicleInventory ⇒ new AsyncDocumentLinkList<Vehicle>(Key); public AsyncDocumentLinkList<Customer> Customers ⇒ new AsyncDocumentLinkList<Customer>(Key); }
Location
public class Location : AsyncDocument<Location>, IIndexable { public override string GetCollectionName() ⇒ "locations"; public AsyncIndexedProperty<string> Name ⇒ new AsyncIndexedProperty<string>(Key); public AsyncIndexedProperty<string> Street ⇒ new AsyncIndexedProperty<string>(Key); public AsyncIndexedProperty<string> City ⇒ new AsyncIndexedProperty<string>(Key); public AsyncIndexedProperty<string> State ⇒ new AsyncIndexedProperty<string>(Key); public AsyncIndexedProperty<string> ZipCode ⇒ new AsyncIndexedProperty<string>(Key); public AsyncIndexedProperty<string> Country ⇒ new AsyncIndexedProperty<string>(Key);
public AsyncProperty<double> Latitude => new AsyncProperty<double>(Key);
public AsyncProperty<double> Longitude => new AsyncProperty<double>(Key);
public AsyncIndexedProperty<string> PhoneNumber => new AsyncIndexedProperty<string>(Key);
public AsyncIndexedProperty<string> Email => new AsyncIndexedProperty<string>(Key);
public AsyncProperty<string> OperatingHours => new AsyncProperty<string>(Key);
public AsyncProperty<string> Type => new AsyncProperty<string>(Key);
public async Task UpdateCoordinatesAsync(double latitude, double longitude)
{
await Latitude.SetAsync(latitude);
await Longitude.SetAsync(longitude);
}
public async Task UpdateAddressAsync(string street, string city, string state, string zipCode, string country)
{
await Street.SetAsync(street);
await City.SetAsync(city);
await State.SetAsync(state);
await ZipCode.SetAsync(zipCode);
await Country.SetAsync(country);
}
}
Querying Data Here's how you would perform a location-based query:
RedisQuery<Location> query = new RedisQuery<Location>();
// Example: Searching for locations in California query.Tag(s ⇒ s.State, "CA");
// Searching for a specific city within California query.Text(s ⇒ s.City, "Los Angeles", 2);
var queryStr = query.ToString(); if (string.IsNullOrEmpty(queryStr)) { var locations = await Location.GetAllAsync(); result = locations.Select(s ⇒ s.Id).ToList(); } else { result = await RedisIndex.SearchAsync<Location>(query); if (result == null) result = new List<string>(); }
Using Async Properties AsyncProperty can handle various types, including complex classes or models:
public class VehicleProfile : AsyncDescendant<VehicleProfile> { public AsyncProperty<VehicleColor> Color ⇒ new AsyncProperty<VehicleColor>(Key); public AsyncProperty<string> Make ⇒ new AsyncProperty<string>(Key); public AsyncProperty<string> Model ⇒ new AsyncProperty<string>(Key); public AsyncProperty<string> Year ⇒ new AsyncProperty<string>(Key); public AsyncProperty<int> TireCount ⇒ new AsyncProperty<int>(Key); }
// Usage examples var vehicle = Vehicle.Create("vehicleId"); var year = await vehicle.Profile.Year.GetAsync(); // Returns string await vehicle.Profile.Year.SetAsync("2027");
// For a class like VehicleColor var color = await vehicle.Profile.Color.GetAsync(); await vehicle.Profile.Color.SetAsync(new VehicleColor { Name = "Red", Code = "#FF0000" });
Redis Singleton Initialization To connect to your Redis server:
RedisSingleton.Initialize("your-redis-host", port: 6379, "your-redis-password");
async Task Main() { // Initialize Redis connection RedisSingleton.Initialize("localhost", port: 6379, "password");
// Create a dealer and manage its inventory
var dealer = Dealer.Create("dealerId1");
var inventory = await dealer.VehicleInventory.GetAllAsync();
// Create and update vehicle details
var vehicle = Vehicle.Create("vehicleId");
await vehicle.Profile.Year.SetAsync("2027");
// Query for locations
var query = new RedisQuery<Location>();
query.Tag(s => s.State, "CA");
var locations = await RedisIndex.SearchAsync<Location>(query);
foreach (var loc in locations)
{
Console.WriteLine($"Found Location: {loc.City.GetAsync().Result}, {loc.State.GetAsync().Result}");
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
- RediSearchClient (>= 2.4.0)
- StackExchange.Redis (>= 2.8.24)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|