小编Cud*_*nny的帖子

具有配置的类库中的实体框架7迁移支架

尝试将迁移添加到位于ASP.NET 5类库中的EF7模型.当运行dnx . ef migration add mymigration失败时会有不同的结果,具体取决于我运行它的项目.

如果我在主项目的文件夹中运行它,它找不到DbContext,这是有道理的,因为DbContext它在共享项目中,而ef命令可能不关心依赖项.

如果我在共享项目的文件夹中运行它,它就无法访问startup.cs中指定的连接字符串.我从这样的问题收集是它从共享的项目工作,如果你指定要在连接字符串OnConfiguring的方法DbContext,但我真的想保持这个代码从配置独立.

我在EF7存储库中遇到了一些问题日志,提到他们实现了用于指定项目和上下文的命令行选项,但没有示例,我无法通过查看提交历史记录中的源代码来弄清楚如何使用它.

ef-migrations entity-framework-core visual-studio-2015 dnx asp.net-core

11
推荐指数
1
解决办法
3990
查看次数

What is the usage of material-ui useScrollTrigger with child target ref?

I am trying to use material-ui's useScrollTrigger with a target other than window like so:

export default props => {
    let contentRef = React.createRef();

    const scrollTrigger = useScrollTrigger({ target: contentRef.current });

    return (
        <React.Fragment>
            <CustomHeader shrink={scrollTrigger} />

            <div ref={contentRef}>
                {props.children}
            </div>
        </React.Fragment>
    );
};
Run Code Online (Sandbox Code Playgroud)

This causes an error to be thrown because contentRef.current is null when useScrollTrigger is called. What is the proper usage of this utility with child elements as a target?

javascript reactjs material-ui

5
推荐指数
1
解决办法
855
查看次数

Caliburn.Micro + MEF +现代用户界面:IContent事件

我已经使用Caliburn.Micro和Modern UI(https://mui.codeplex.com)开始了一个项目,并且在我的视图模型上触发IContent的导航事件时遇到了一些困难.我已经让这两个人联系起来与以下人员一起工作:

CM Bootstrapper:

public class CMBootstrapper : Bootstrapper<IShell> {
    private CompositionContainer container;
    private DirectoryCatalog catalog;

    public CMBootstrapper() { }

    protected override void Configure() {
        catalog = new DirectoryCatalog(".", "*.*");
        container = new CompositionContainer(catalog);

        var compositionBatch = new CompositionBatch();
        compositionBatch.AddExportedValue<IWindowManager>(new WindowManager());
        compositionBatch.AddExportedValue<IEventAggregator>(new EventAggregator());
        compositionBatch.AddExportedValue(container);
        container.Compose(compositionBatch);
    }

    protected override IEnumerable<Assembly> SelectAssemblies() {
        List<Assembly> assemblies = new List<Assembly>();
        assemblies.Add(Assembly.GetExecutingAssembly());
        return assemblies;
    }

    protected override object GetInstance(Type serviceType, string key) {
        string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
        var exports …
Run Code Online (Sandbox Code Playgroud)

c# mef caliburn.micro wpf-4.5 modern-ui

4
推荐指数
1
解决办法
2861
查看次数

C#引用的对象集

我想要的是一个由他们的类引用的对象的唯一集合或集合.该集合只能包含给定类的一个对象.以下是一些可能的功能示例:

class A;
class B;
class C;

A a = new A();
B b = new B();
C c = new C();

UnknownCollection<object> objects;
objects.Add(A, a);    // Add(key, value)
objects.Add(B, b);
objects.Add(C, c);
var something = objects[A]; // return a reference to 'a' using class A as a key
Run Code Online (Sandbox Code Playgroud)

如果这些行中的某些内容尚不存在,是否可以创建一个具有合理性能的方法?

.net c# collections set

2
推荐指数
1
解决办法
112
查看次数

Android App,"源未找到"调试错误 - 尝试下载Android源代码

我的Android应用程序中出现错误,上面写着"找不到源"并导致程序崩溃.我已经阅读了很多帖子说解决方案是下载android源代码并在Eclipse中加载,但我试着无济于事.

以下是一些可能对我的问题有帮助的信息,如果您需要更多,请告诉我们!

堆:

Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThrea d$ActivityRecord, Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread $ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
Run Code Online (Sandbox Code Playgroud)

第一个条目是'ActivityThrea d'并且'd'被截断是不是很奇怪?如果这是问题,出了什么问题,我该如何解决?

调试停止的代码行:

public void AddAnimationID(String index, Integer view)
{
 animations.put(index, view);
}
Run Code Online (Sandbox Code Playgroud)

'animations'是一个字典,是Alien类的成员.我称之为:

Alien alien; …
Run Code Online (Sandbox Code Playgroud)

java android

1
推荐指数
1
解决办法
1万
查看次数

MySql + InnoDB + PHP单引号歧视?

好的,我最近将一些表转换为InnoDB存储引擎,每当我在INSERT语句的列列表中使用单引号时,我就会收到错误:

INSERT INTO 'Table' ('Col1', 'Col2') VALUES ('Val1', 'Val2')
Run Code Online (Sandbox Code Playgroud)

当我厌倦了使用phpMyAdmin生成一个正确的语句时,它看起来几乎一样,所以我将它粘贴在我的应用程序中,并且它有效.然后我的下一个声明有同样的错误,所以我开始怀疑.经过一段时间的游戏,我发现问题是查询需要一个反向滴答而不是单引号,但不是整个事情.

INSERT INTO `Table` (`Col1`, `Col2`) VALUES ('Val1', 'Val2')
Run Code Online (Sandbox Code Playgroud)

工作,所以它不像MySql不理解单引号.这里发生了什么?我也不能像以前那样使用MyISAM保留未加引号的列(即:表(Col1,Col2))

php mysql innodb

0
推荐指数
1
解决办法
334
查看次数