我最近发现了Typescript.来自OOP C#背景,我发现Javascript非常难以使用,并且对Typescript自然感到兴奋.
我目前正在我的应用程序中使用Backbone.Marionette.js来管理未来的复杂性(未来因为它仍处于早期阶段而尚未复杂).
现在我明白Backbone.js仍有空间在我的应用程序中发挥重要作用,即使我使用的是Typescript,但是我学习的Typescript越多(并开始喜欢它),我就越开始认为它的目标是管理企业应用程序的复杂性与Marionette试图完成的任务重叠太多.我知道他们以两种完全不同的方式做到这一点但是来自C#我当然更喜欢OOP方法而不是另一种JS插件.
我的考虑因素是从我的申请中逐步淘汰木偶,还是没有比我想象的更少的重叠?请记住,我是所有3 Backbone,TypeScript和Marionette的新手,这是我用过它的第一个应用程序,这让我很难评估这个问题.
我以为我会很聪明并且写一些像这样的代码示例.它似乎也是一种干净而有效的方式来填充数组而不需要第二次枚举.
int i = 0;
var tickers = new List<string>();
var resultTable = results.Select(result => new Company
{
Ticker = tickers[i++] = result.CompanyTicker,
});
Run Code Online (Sandbox Code Playgroud)
我真的不关心另一种方法,因为我可以通过for循环轻松实现这一点.我更感兴趣为什么这个片段不起作用,即tickers.Count = 0代码运行后,尽管有100多个结果.谁能告诉我为什么我会遇到这种意外行为?
考虑以下RDF:
semapi:BaseClass a rdfs:Class;
rdfs:subClassOf rdfs:Class .
semapi:hasChainTo a rdf:Property;
rdfs:domain semapi:BaseClass;
rdfs:range semapi:BaseClass .
semapi:DerivedClass a rdfs:Class; rdfs:subClassOf semapi:BaseClass .
instances:Instance1 a semapi:DerivedClass;
semapi:hasChainTo (
[
a semapi:DerivedClass;
semapi:hasChainTo (
[C1]
[C2]
)
]
)
Run Code Online (Sandbox Code Playgroud)
如果semapi:hasChainTo rdfs:range semapi:BaseClass那么它意味着列表是rdf:type semapi:BaseClass.
我真正的意思是说每个项目在列表rdf:type(EI, [C1] rdf:type semapi:BaseClass,[C2] rdf:type semapi:BaseClass,...)
我怎样才能做到这一点?我需要猫头鹰(最好不要)吗?
在我的实体框架中,种子方法我有以下行来从不同的项目中获取文件:
var filePath = new DirectoryInfo(HostingEnvironment.ApplicationPhysicalPath).Parent.FullName + "\\Com.ProjectX\\companies.xls";
Run Code Online (Sandbox Code Playgroud)
这在HttpContext可用时有效,就像使用此操作方法触发它一样:
public ActionResult About()
{
var configuration = new Com.EntityModel.Configuration();
var migrator = new System.Data.Entity.Migrations.DbMigrator(configuration);
migrator.Update();
return View();
}
Run Code Online (Sandbox Code Playgroud)
但是,当我Update-Database从包管理器控制台执行时它不起作用(找不到文件并且很难调试,因为我在执行此操作时也无法断点).
我希望能够使用Update-Database命令并让它在没有HttpContext的情况下工作.我怎样才能得到这条路?
我在这里描述的问题没有答案,仅使用Unity.
我正在尝试注册ISecureDataFormat<>最新的VS2013(更新2)SPA/Web Api模板.
我试过了
container.RegisterType(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>));
container.RegisterType<ISecureDataFormat<AuthenticationTicket>, SecureDataFormat<AuthenticationTicket>>();
container.RegisterType<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();
Run Code Online (Sandbox Code Playgroud)
它"有效"但不是真的,因为它抱怨了该树中的下一个依赖性,IDataSerializer ......然后是下一个IDataProtector,我发现没有实现.
假设我想将以下原型添加到String类中.
String.prototype.beginsWith = function (string) {
return(this.indexOf(string) === 0);
};
Run Code Online (Sandbox Code Playgroud)
我需要添加beginWith到lib.d.ts否则它将不会complile:
declare var String: {
new (value?: any): String;
(value?: any): string;
prototype: String;
fromCharCode(...codes: number[]): string;
//Here
}
Run Code Online (Sandbox Code Playgroud)
文件被锁定,我无法编辑它.
我发布我可以var String: any在通话前声明 ,但我可以将其内置吗?
以下代码抛出此异常的原因是什么:"表达式必须是MethodCallExpression.我认为调用Action是那个..
Action startBouncePolling = new Action(async () =>
{
});
BackgroundJob.Enqueue(() => startBouncePolling());
Run Code Online (Sandbox Code Playgroud)
入队的签名是一个参数 Expression<Action>
如果我编写以下查询会发生什么:
SELECT *
FROM table
WHERE name IN (select name from someotherTable where id = 3)
Run Code Online (Sandbox Code Playgroud)
并且内部查询(在IN语句内)不返回结果集
外部会自动评估为True还是False?
给定以下2个字符串,如何在不使用正则表达式的情况下从每个字符串中获取第一个整数:
"Result Set 25: 171 companies" => get 25
"Other Text 22 : 140 companies" => get 22
Run Code Online (Sandbox Code Playgroud) c# ×3
linq ×2
typescript ×2
async-await ×1
backbone.js ×1
javascript ×1
marionette ×1
rdf ×1
rdfs ×1
semantic-web ×1
sql ×1
turtle-rdf ×1