public static TankInstance GetInstance(TankUnikey key)
        {
            IRepository repository;
            IXQueryable tank;

            if (key.TryGetTank(out tank, out repository))
            {
                return(TankInstanceManager.GetInstance(repository, tank, key));
            }
            else
            {
                return(null);
            }
        }
        private static TankInstance GetInstance(IRepository repository, IXQueryable tank, TankUnikey unikey)
        {
            var key = unikey.ToString();

            return(s_instances.GetOrCreate(key, () =>
            {
                var storage = TankInstanceManager.GetRepositoryTankConfigInfoStorage(repository);
                TankInstanceConfigurationInfo configInfo;
                storage.TryGetValue(key, out configInfo);
                var instance = new TankInstance(repository, TankEntity.Create(tank), configInfo);
                storage[key] = instance.ConfigurationInfo;
                return instance;
            }));
        }
 public static TankInstance GetInstance(IRepository repository, IXQueryable tank)
 {
     return(TankInstanceManager.GetInstance(repository, tank, new TankUnikey(repository, tank)));
 }