我目前有一个利用Entity Framework Code-First迁移和Web Publish的项目,其中connectionStrings存储在web.config文件中.
现在是时候将connectionStrings移到web.config之外了,因此我们将它们放入connectionString.config文件中,然后慢慢地将它们转换为webpublish.
connectionStrings.config
<connectionStrings>
<!-- Testing Databases -->
<add
connectionString="server=testserver;database=testdatabasename;user id=someid;password=*******"
name="dbname"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
web.config相关部分
<connectionStrings configSource="config\connectionStrings.config">
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
现在,当我加载Web Publish(Build - > Publish Project)的对话框时,在设置选项卡中我收到错误
No Databases found in the project
Run Code Online (Sandbox Code Playgroud)
这向我表明对话框不够智能,无法查看configSource并从那里加载数据.我可以确认在我的开发人员环境中正确加载了connectionStrings,我还可以确认slowcheetah正在将配置转换为它的生产环境.
有没有办法让Visual Studio Publish看到我的配置配置,并允许代码优先迁移?
asp.net entity-framework webdeploy ef-migrations visual-studio-2013
我正在尝试在Typescript项目中使用第三方库(特别是三个).作为概念验证,我正在尝试将所有客户端代码解析为模块(无需转换为ES5或捆绑).
我的项目设置如下:
cgi/app.js (compiled typescript file)
node_modules/@types
node_modules/three/build/three.module.js
src/app.ts
index.html
tsconfig.json
package.json
Run Code Online (Sandbox Code Playgroud)
在我的 index.html
<head>
<script type="module" src="node_modules/three/build/three.module.js"></script>
<script type="module" src="cgi/app.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用typescript解析three.module.js文件,同时还使用来自的类型声明@types/three.通常,您可以使用以下内容导入库:import { Scene } from 'three'这为我提供了类型支持,但编译后的模块没有正确的ES6语法.它需要import { Scene } from './path/to/three.js.
不幸的是,typescript 不支持自动执行此操作.我可以直接导入ES6模块(不使用@types)但是我失去了类型支持.
postcriptcript编译,是否可以将模块分辨率从节点语法转换为ES6语法?(例如import { Scene } from 'three'转换为import { Scene } from './three.js'?
具体来说,是否可以利用汇总来实现这一目标?
我目前正在尝试从实体框架自动迁移切换到代码优先迁移.对于一个小背景故事,这个解决方案分为四个单独的项目:数据,模型,服务和Web.连接字符串信息位于Web项目中,上下文位于数据项目中.
现在,我已经运行了"启用 - 迁移",这似乎已正常运行.
从那里,我删除了数据库中现有的migrationHistory表.
运行
Add-Migration -projectName Data"
Run Code Online (Sandbox Code Playgroud)
将生成适当的迁移.
问题是当我尝试运行Update-Database时,会导致一般错误:
> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or
> was not accessible. Verify that the instance name is correct and that
> SQL Server is configured to allow remote connections. (provider: SQL
> Network Interfaces, error: 26 - Error Locating Server/Instance
> Specified)
Run Code Online (Sandbox Code Playgroud)
我可以使用web.config中提供的凭据连接到数据库,并且数据库连接在过去几个月中已正常工作,因此我认为这不是连接问题,除非代码优先迁移需要不同于自动的端口移民.
我假设它只是没有看到web.config中提供的连接字符串,无论如何运行
Update-Database -projectName data -startupprojectname web
Run Code Online (Sandbox Code Playgroud)
导致相同的错误
我的问题:
在给出上述信息的情况下,如何解决与网络相关的通用错误?这个问题是否是一个可见性问题,其中数据项目代码优先迁移无法在Web项目中看到连接字符串?
嗨,我有'home'控制器和umbraco 7中的'sort'控制器.'home'控制器可以正常处理索引操作,因为它是从RenderMvcController重写的.首先,我很困惑我应该在哪个实例中使用哪个控制器,即表面控制器或rendermvccontroller.我似乎无法访问下面的twitter动作,这是我需要的ajax.我是否需要将twitter动作放在表面控制器中,还是可以在umbraco中使用常规的mvc控制器?
public override ActionResult Index(RenderModel model)
{
var storedProcedure = new StoredProcedure()
{
ConnectionString = ConfigurationManager.ConnectionStrings["CentralDbContext"].ConnectionString
};
DataSet ds = storedProcedure.ExecuteProcedureToDataSet("GetHomePage");
IMapSetup map = new MapHomePage();
HomePage homepage = map.Setup<HomePage>(ds);
homepage.Slideshow = CurrentPage.AncestorsOrSelf(1).First().Descendants("SlideshowItem").Take(5).AsMany<Slideshow>();
this._weatherSettings.DefaultLocation = "warrington";
homepage.Forecast = new Forecaster(this._weatherSettings, this._cacheHelper).GetWeather(this._weatherSettings.DefaultLocation);
return CurrentTemplate(homepage);
}
public ActionResult TwitterSort(int? page)
{
int currentPageIndex = page.HasValue ? page.Value - 1 : 0;
var storedProcedure = new StoredProcedure()
{
ConnectionString = ConfigurationManager.ConnectionStrings["CentralDbContext"].ConnectionString
};
DataSet ds = storedProcedure.ExecuteProcedureToDataSet("GetHomePage");
IMapSetup map = new MapHomePage();
HomePage …Run Code Online (Sandbox Code Playgroud) 在MDN文档中,我看到了WebComponents可以实现的名为的函数adoptedCallback。MDN文档说明:
“将自定义元素移到新文档时调用。”
https://developer.mozilla.org/zh-CN/docs/Web/Web_Components/Using_custom_elements
https://github.com/w3c/webcomponents/issues/512
自定义元素已移至新文档是什么意思?我应该在什么情况下实施?
asp.net ×2
asp.net-mvc ×1
database ×1
es6-modules ×1
javascript ×1
rollupjs ×1
typescript ×1
umbraco ×1
webdeploy ×1