在第二版我可以使用
徽章徽章 - 重要
我看到.badge元素不再具有上下文(-success,-primary等)类.
我如何在版本3中实现相同的功能?
例如.我想在我的UI中使用警告徽章和重要徽章
是否可以使用Dapper的匿名类型?
我可以看到你如何使用动态ie
connection.Query<dynamic>(blah, blah, blah)
Run Code Online (Sandbox Code Playgroud)
然后可以做一个
.Select(p=> new { A, B ,C })
Run Code Online (Sandbox Code Playgroud)
或之后的一些变化?
编辑
我想我会告诉你我现在如何使用Dapper.我倾向于缓存(使用InMemoryCache)数据,所以我只是在开头做一个大查询(使用Dapper超级快)然后我使用Linq在我的存储库中对它进行排序.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Common;
using System.Linq;
using Dapper;
namespace SomeNamespace.Data
{
public class DapperDataContext : IDisposable
{
private readonly string _connectionString;
private readonly DbProviderFactory _provider;
private readonly string _providerName;
public DapperDataContext()
{
const string connectionStringName = " DataContextConnectionString";
_connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
_providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName;
_provider = DbProviderFactories.GetFactory(_providerName);
}
public IEnumerable<MyDataView> MyData1 { get; private set; }
public IEnumerable<MyDataView> MyData2 { …Run Code Online (Sandbox Code Playgroud) 我想在我在OSX上使用Visual Studio Code编写的控制台应用程序中引用System.Drawing.dll.即我想使用这些使用语句
using System.Drawing;
using System.Drawing.Imaging;
Run Code Online (Sandbox Code Playgroud)
避免这种构建错误
Program.cs(56,20): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)
我找不到这方面的教程,我甚至不知道dll是否可用于.net核心或单声道或任何visual-studio-code使用.
我正在创建这个模型作为我的代码第一个实体框架的一部分
public class NewUserRegistration
{
[Key]
public int NewUserRegistrationId { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
使用Update-Database -Verbose -ForcePackage Manger Console中的命令在此更新过程中会出现此异常Applying automatic migration: 201211252223088_AutomaticMigration.
ALTER TABLE [dbo].[NewUserRegistration] ADD [NewUserRegistrationId] [int] NOT NULL IDENTITY System.Data.SqlClient.SqlException(0x80131904):为表'NewUserRegistration'指定的多个标识列.每个表只允许一个标识列.在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,Boolean breakConnection,Action
1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,布尔callerHasConnectionLock,布尔asyncClose)的System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,Boolean&)中的1 wrapCloseInAction) dataReady)在System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName,Boolean async,Int32 timeout),System.Data.SqlClmand.SmandCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement) at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement) at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable …
可以说我有一系列形成聚合的对象.
public class C{
public string Details {get;set;}
}
public class B{
public string Details {get;set;}
public List<C> Items {get;set;}
}
public class A{
public long ID {get;set;}
public string Details {get;set;}
public List<B> Items {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
使用Dapper,从数据库中的表填充这些内容的最佳方法是什么(在我的情况下,它是postgres,但这应该无关紧要).示例中的表几乎是一对一的对象模型.类的Items属性,表示与每个从属对象的外键关系.即3个表,A与B具有一对多关系,B与C具有一对多的关系.
因此,对于给定的AI ID,我希望我的对象也拥有所有子数据.
我最好的猜测是我应该以某种方式使用QueryMultiple,但我不确定如何做到最好.
有人可以解释之间的差异SatisfyImportsOnce和ComposeParts为什么人会在哪里工作,其他没有?
具体来说,我有一个MVC Web应用程序,我正在使用MEF.下面是一些代码(来自该应用程序),当我使用时工作,SatisfyImportsOnce但在我使用时不工作ComposeParts.我的理解是ComposeParts从一组属性对象创建可组合部分,并在指定的组合容器中组合它们,并SatisfyImportsOnce 使用指定的组合服务组成指定的部分.对于我简单的猴子脑,即使英语不同,它们在语义上是相同的.两者都使用CompositionContainer在导入目标上吐出导出的类型.
public class FormPartCustomatorFactory
{
[ImportMany(typeof(ICustomRenderer), AllowRecomposition = true)]
private readonly List<Lazy<ICustomRenderer, ICustomRendererMetaData>> _rendererImports = new List<Lazy<ICustomRenderer, ICustomRendererMetaData>>();
private readonly Dictionary<string, Lazy<ICustomRenderer, ICustomRendererMetaData>> _renderers;
public static readonly FormPartCustomatorFactory Instance = new FormPartCustomatorFactory();
static CompositionContainer _container;
private FormPartCustomatorFactory()
{
using (var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "*.dll"))
{
_container = new CompositionContainer(catalog);
_container.SatisfyImportsOnce(this); // <- Works
// _container.ComposeParts(this); // DOESN'T Work
_renderers = _rendererImports.ToDictionary(q => q.Metadata.Name, …Run Code Online (Sandbox Code Playgroud) 当我尝试在一个空的mvc4 web项目中安装包Twitter.Bootstrap时,我得到了这个
Install-Package Twitter.Bootstrap
Attempting to resolve dependency 'bootstrap (? 3.0.1)'.
Attempting to resolve dependency 'jquery (? 1.9.0)'.
Install-Package : External packages cannot depend on packages that target projects.
At line:1 char:1
+ Install-Package Twitter.Bootstrap
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?
我正在学习角度2,我已经为我想要在我的一个服务中使用的truncate方法编写了一个ts定义.
truncate.ts
interface String {
truncate(max: number, decorator: string): string;
}
String.prototype.truncate = function(max, decorator){
decorator = decorator || '...';
return (this.length > max ? this.substring(0,max)+decorator : this);
};
Run Code Online (Sandbox Code Playgroud)
如何将其导入另一个打字稿模块或至少使其可以全局使用.
所以在WPF中,我可以像这样声明一个富文本框
<RichTextBox Text="{Binding Text}" SpellCheck.IsEnabled="True" />
Run Code Online (Sandbox Code Playgroud)
通过一些奇迹,在拼写错误的单词下出现了一些奇怪的线条.
但所使用的方言是一个美国人,它有各种各样的差异,这对澳大利亚观众来说是不可接受的.
我知道我能做到这一点......
<RichTextBox Text="{Binding Text}" SpellCheck.IsEnabled="True" >
<SpellCheck.CustomDictionaries>
<!-- customwords.lex is included as a content file-->
<sys:Uri>pack://application:,,,/customwords.lex</sys:Uri>
</SpellCheck.CustomDictionaries>
</RichTextBox>
Run Code Online (Sandbox Code Playgroud)
并使用不同的单词填充customwords.lex.
#LID 1033
colour
summarising
Summarise
Organisation
maximise
etc...
Run Code Online (Sandbox Code Playgroud)
坦率地说,对于我来说,用一些额外的不同词语填写自定义词典并且它仍然不会突出在澳大利亚语境中错误的美国主义,这有点麻烦.
我四处寻找.Net语言包,如果我想要除了英语方言之外的任何其他语言,我想我会没事,但我没有英语(澳大利亚或英国)可以使用.
我是否只是关闭拼写检查?或者有没有办法在那里找到合适的词典.
我刚刚开始了一项新工作,他们的代码管理是一个无纪律的混乱.通常情况下这是可以的,我可以应付它,但在这个地方,这是非常糟糕的.
他们使用TFS ......我无能为力.没有机会引入git,但我一直在阅读关于git-flow的内容,我想知道是否有一套工具可以使用开箱即用的TFS工具管理分支和hotfixing,如git-flow.
至少我很感激被引导到任何文档,实践,备忘单等,这使得教授程序员团队的任务更容易使用源代码控制.这不仅仅是一个软件问题,也是一个心灵的问题.
c# ×4
dapper ×2
angular ×1
c#-4.0 ×1
git-flow ×1
javascript ×1
mef ×1
nuget ×1
orm ×1
richtextbox ×1
sql ×1
tfs2012 ×1
typescript ×1
wpf ×1