我正在使用一个单独的javascript文件来放入我的React JS JSX.当我使用文档给出的示例时,我得到了大量的Visual Studio警告和丑陋的波浪线.
我无法找到解决这个问题的方法.对于React JS来说,这几乎是一个突破.

我无法从 CRM 插件访问外部数据库。我收到的错误是:
"Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx' failed."
Run Code Online (Sandbox Code Playgroud)
该代码在“单元测试”中本地运行良好。我确保将插件隔离模式设置为“无”。我尝试向这篇文章寻求帮助,并尝试了它建议的所有内容,但没有成功。
这是我当前使用的代码:
var conn = new SqlConnection(@"Server=MyServer\Instance;DataBase=MyDB;User Id=MyUser;Password=MyPassword;Integrated Security=false;");
conn.Open();
Run Code Online (Sandbox Code Playgroud)
我还尝试了此连接字符串并授予 NT AUTHORITY\NETWORK SERVICE 用户对数据库的访问权限。
var conn = new SqlConnection(@"Data Source=MyDS\Instance;Initial Catalog=MyDB;Integrated Security=SSPI;");
conn.Open();
Run Code Online (Sandbox Code Playgroud)
我使用的是 Dynamics CRM 2015 On-Premise。
更新:我在没有调试的时候发现它可以工作,但是当我尝试通过插件注册工具调试它时出现错误。知道为什么会发生这种情况吗?
我目前正在学习依赖注入,以便使用MVC创建更易于维护的代码.我已经向我的控制器注入模型和计算器服务,而不是具有新的依赖性.
我在构造函数中有一些Convert.ToDecimal调用,并且不知道是否需要担心使用依赖注入来移除静态方法调用,这是一种DI设计气味.删除太远了吗?
private readonly ICalculationService _calculation;
private readonly ICalculatorModelService _calculatormodel;
public CalculatorController(ICalculationService calculation,
ICalculatorModelService calculatormodel) {
_calculation = calculation;
_calculatormodel = calculatormodel;
}
public ActionResult Index() {
var model = _calculatormodel;
return View(model);
}
public PartialViewResult Calculate(string submit, string txtValue,
string value1) {
var model = _calculatormodel;
if (submit == "+")
{
if (Session["value1"] == null)
Session.Add("value1",Convert.ToDecimal(txtValue));
else
Session["value1"] = value1;
}
else if (submit == "=")
{
if (Session["value1"] == null)
Session.Add("value1", 0);
model.Result = _calculation.Calculate(Convert
.ToDecimal(Session["value1"]), Convert.ToDecimal(txtValue));
} …Run Code Online (Sandbox Code Playgroud) 我有打字稿1.5.3和视觉工作室2015.
我在我的打字稿中使用外部模块,但由于以下错误而无法构建:"构建:除非提供'--module'标志,否则无法编译模块."
打字稿设置:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Any CPU'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
<TypeScriptRemoveComments>False</TypeScriptRemoveComments>
<TypeScriptOutFile />
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptSourceMap>True</TypeScriptSourceMap>
<TypeScriptMapRoot />
<TypeScriptSourceRoot />
Run Code Online (Sandbox Code Playgroud)
模块:
export class Functions {
errorHelper(xhr: any, errorType: any, exception?: any) {
var errorMessage = exception || xhr.statusText;
alert(`Account lookup failed. ${errorMessage}`);
}
getParameterByName(name: string) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp(`[\?&]${name}=([^&#]*)`);
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
Run Code Online (Sandbox Code Playgroud)