Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Dynamo.Ioc/Index/DirectIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public IRegistration Get(Type type)
{
if (type == null)
throw new ArgumentNullException("type");
if (!_defaultIndex.ContainsKey(type))
throw new KeyNotFoundException("type " + type.FullName + " is not in the index");

return _defaultIndex[type];
}
Expand All @@ -65,19 +67,18 @@ public IRegistration Get(Type type, object key)
throw new ArgumentNullException("type");
if (key == null)
throw new ArgumentNullException("key");
if (!_keyedIndex.ContainsKey(type))
throw new KeyNotFoundException("type " + type.FullName + " is not in the index");

return _keyedIndex[type][key];
}
public IRegistration Get<T>()
{
return _defaultIndex[typeof(T)];
return Get(typeof(T));
}
public IRegistration Get<T>(object key)
{
if (key == null)
throw new ArgumentNullException("key");

return _keyedIndex[typeof(T)][key];
return Get(typeof(T), key);
}

public bool TryGet(Type type, out IRegistration registration)
Expand Down
8 changes: 6 additions & 2 deletions Dynamo.Ioc/Index/GroupedIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,27 @@ public IRegistration Get(Type type)
{
if (type == null)
throw new ArgumentNullException("type");
if (!_index.ContainsKey(type))
throw new KeyNotFoundException("type " + type.FullName + " is not in the index");

return _index[type].Get();
}
public IRegistration Get(Type type, object key)
{
if (type == null)
throw new ArgumentNullException("type");
if (!_index.ContainsKey(type))
throw new KeyNotFoundException("type " + type.FullName + " is not in the index");

return _index[type].Get(key);
}
public IRegistration Get<T>()
{
return _index[typeof(T)].Get();
return Get(typeof(T));
}
public IRegistration Get<T>(object key)
{
return _index[typeof(T)].Get(key);
return Get(typeof(T), key);
}

public bool TryGet(Type type, out IRegistration registration)
Expand Down