public DesignCloudViewModel(UserDto user, CloudModel appModel, TokenModel token, ApiClientContext apiContext, string webUrl) { //关联对象 BimToken = token; BimUser = user; AppModel = appModel; Context = apiContext; _dispName = appModel.App.Name; VaultClient = Context.GetVaultClient(); WebURL = webUrl; //所有项目 foreach (var proj in appModel.Projects) { _allProject.Add(ProjDtoToProjModel(proj)); } _allProject = _allProject.OrderByDescending(p => p.ProjId).ToList(); //命令 ShowHomeViewCmd = new DelegateCommand(ShowHomeView); RefreshCmd = new DelegateCommand(Refresh); }
private static void RegisterDependencies(HttpConfiguration config) { ContainerBuilder builder = new ContainerBuilder(); ApiClientContext apiClientContex = ApiClientContext.Create(cfg => cfg.ConnectTo("http://localhost:18132") .SetCredentialsFromAppSetting("Api:UserName", "Api:Password")); builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); builder.Register(c => apiClientContex.GetCarsClient()).As <ICarsClient>().InstancePerApiRequest(); config.DependencyResolver = new AutofacWebApiDependencyResolver(builder.Build()); }
private static IContainer RegisterServices(ContainerBuilder builder) { builder.RegisterControllers(typeof(MvcApplication).Assembly); ApiClientContext apiClientContex = ApiClientContext.Create(cfg => cfg.SetCredentialsFromAppSetting( "Api:AffiliateKey", "Api:Username", "Api:Password") .ConnectTo("https://localhost:44306")); // Register the clients builder.Register(c => apiClientContex.GetShipmentsClient()) .As <IShipmentsClient>().InstancePerHttpRequest(); builder.Register(c => apiClientContex.GetShipmentTypesClient()) .As <IShipmentTypesClient>().InstancePerHttpRequest(); return(builder.Build()); }