-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,33 @@ namespace LEGO.AsyncAPI.Models | |
using LEGO.AsyncAPI.Models.Interfaces; | ||
using LEGO.AsyncAPI.Writers; | ||
|
||
public static class BindingExtensions | ||
Check warning on line 10 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI)
Check warning on line 10 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI.Bindings)
Check warning on line 10 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / build (macos-latest)
Check warning on line 10 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI.Readers)
|
||
{ | ||
public static bool TryGetValue<TBinding>(this AsyncApiBindings<IServerBinding> bindings, out IServerBinding binding) | ||
where TBinding : IServerBinding | ||
{ | ||
return bindings.TryGetValue(Activator.CreateInstance<TBinding>().BindingKey, out binding); | ||
} | ||
|
||
public static bool TryGetValue<TBinding>(this AsyncApiBindings<IChannelBinding> bindings, out IChannelBinding binding) | ||
where TBinding : IChannelBinding | ||
{ | ||
return bindings.TryGetValue(Activator.CreateInstance<TBinding>().BindingKey, out binding); | ||
} | ||
|
||
public static bool TryGetValue<TBinding>(this AsyncApiBindings<IOperationBinding> bindings, out IOperationBinding binding) | ||
where TBinding : IOperationBinding | ||
{ | ||
return bindings.TryGetValue(Activator.CreateInstance<TBinding>().BindingKey, out binding); | ||
} | ||
|
||
public static bool TryGetValue<TBinding>(this AsyncApiBindings<IMessageBinding> bindings, out IMessageBinding binding) | ||
where TBinding : IMessageBinding | ||
{ | ||
return bindings.TryGetValue(Activator.CreateInstance<TBinding>().BindingKey, out binding); | ||
} | ||
} | ||
|
||
public class AsyncApiBindings<TBinding> : Dictionary<string, TBinding>, IAsyncApiReferenceable | ||
Check warning on line 37 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI)
Check warning on line 37 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI.Bindings)
Check warning on line 37 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / build (macos-latest)
Check warning on line 37 in src/LEGO.AsyncAPI/Models/AsyncApiBindings.cs GitHub Actions / Publish NuGet packages (LEGO.AsyncAPI.Readers)
|
||
where TBinding : IBinding | ||
{ | ||
|