namespace zero.Stores;
public partial class StoreOperations : IStoreOperations
{
///
/// Get new instance of an entity
///
public virtual Task Empty() where T : ZeroIdEntity, new()
{
return Task.FromResult(new T());
}
///
public virtual Task Empty(string flavor) where T : ZeroIdEntity, ISupportsFlavors, new()
{
FlavorConfig config = Flavors.Get(flavor);
T result = config?.Construct(config) as T;
if (result == null)
{
return Task.FromResult(default);
}
result.Flavor = flavor;
return Task.FromResult(result);
}
///
public virtual Task Empty(string flavor)
where T : ZeroIdEntity, ISupportsFlavors, new()
where TFlavor : T
{
FlavorConfig config = Flavors.Get();
TFlavor result = config?.Construct(config) as TFlavor;
if (result == null)
{
return Task.FromResult(default);
}
result.Flavor = flavor;
return Task.FromResult(result);
}
}