小编Max*_*imc的帖子

实体框架5 Nuget控制台命令

所以我首先使用EF 5 Code制作数据库,我检查了一些指南并找到了一些"重要"/有用的命令,如:"Update-Database -Force -Verbose".但是我知道必须有更多这样的命令,例如:"Purge-Database",但找不到它们没有成功.所以我的问题是,在哪里可以找到EF 5的所有可用命令和标志(例如:-Force,-Verbose等).

我试过谷歌但没有运气,因为查询"EF 5控制台"等有控制台,它给出了控制台应用程序的结果,我不想要它.

command-line entity-framework nuget ef-migrations

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

ASP.NET MVC 4如何使用自定义membershipprovider和roleprovider实现Oauth

经过大量的搜索和大量的尝试,我终于想出了如何让人们在我的网站上注册和登录(并给他们角色等并做授权).我从类ExtendedMembershipProvider和RoleProvider继承,为他们创建了一个自定义类,但现在我仍然遇到让Oauth工作的问题(主要是OpenID).我在AuthConfig中注册了GoogleClient,但是一旦我尝试登录它就到了该行(在AccountController.cs中):

    if (OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: false))
Run Code Online (Sandbox Code Playgroud)

然后它说尚未实现,现在我检查了扩展成员资格,我不能覆盖登录(因为它不在那里,但它在哪里).我也搜索了谷歌很多,但没有运气,任何获得oauth工作的说明都会出汗(我想我需要制作第3个CustomOath提供者,但我无法找到继承者的内容)!

PS:我制作了一个custommembershiprpovder和customroleprovider,因为我想使用不同的数据库方案.

格言

c# asp.net security asp.net-mvc-4

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

将List <boolean>转换为String

我得到了一个包含92个布尔值的布尔列表,我希望将列表转换为字符串,我想我将取8个布尔值(位)并将它们放入字节(8位)然后使用ASCII将其转换为字节将值添加到字符串然后将字符添加到字符串.然而,经过超过2个小时的googeling,没有运气atm.我尝试将列表转换为字节列表但它没有工作^^.

String strbyte = null;
for (int x = 0; x != tmpboolist.Count; x++) //tmpboolist is the 90+- boolean list
{
   //this loop checks for true then puts a 1 or a 0 in the string(strbyte)
   if (tmpboolist[x])
   {
      strbyte = strbyte + '1'; 
   }
   else
   {
      strbyte = strbyte + '0';
   }
}

//here I try to convert the string to a byte list but no success
//no success because the testbytearray has the SAME size as the 
//tmpboolist(but …
Run Code Online (Sandbox Code Playgroud)

c# string boolean list

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

在MVVM中使用数据库建模

您好我正在尝试学习MVVM,我对某些部分有点不确定,主要是(数据)模型需要与VM通信的部分(ViewModel).

所以我有一个班级人员,它有很多属性(使用Raiseproperty(INotifyPropertyChanged)).现在我该怎么该类连接到虚拟机我会做一个新的类并调用它ViewModelPerson,但我主要是想人的名单,因为只显示1人有点没用,列表将被从数据库中收集(SQLite的与Dapper.现在我需要在viewmodel或(data)模型中创建可观察列表?我想在ViewModel中,因为我需要将它绑定到View,但是我在哪里将数据库信息插入到ViewModel ObservableCollection中?我是否将它放在像ViewModelPersonsList构造函数这样的构造函数中,该构造函数具有Query以从SQlite DB收集所有人并将其插入列表中?

希望您了解我无法理解MVVM模型的地方,如果有什么不清楚的地方请问,我会尝试更好地解释我的问题.

格言

c# database sqlite mvvm

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

每30秒运行一次SQL查询(计数),然后将输出保存到某个文件

我正在开发一个网站,并有一个人们可以插入数据(投票)的数据库.我想在标题中保留一个计数器,就像"x"投票一样.但很可能很快就会在网站上出现大量流量.现在我可以使用查询来完成它

SELECT COUNT(*) FROM `tblvotes
Run Code Online (Sandbox Code Playgroud)

然后在标题中显示数字,但是每次用户更改页面时,它都会重做查询,所以我在想,也许每30秒查询一次更好(在mysql服务器上负载少得多)但是然后我需要将它的输出保存到某个地方(这应该不会那么难;我可以将它写入文本文件?)但是如何让我的网站每隔30秒自动运行查询并将数字放入文件.我没有SSH到服务器所以我不能crontab它?

如果有什么你可能不明白随意问!

php sql file

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

Microsoft WPF转换器

所以我今天在MSDN上找到了一个转换器列表,现在我想使用它们中的一些.然而,在搜索了一下后,我似乎无法找到关于它们的任何东西.

我主要想使用IntToBoolConverter.但是我不知道如何使用转换,因为没有提供如何做到(或在谷歌)的信息.

我知道自己很容易制作这个转换器,但我是一名程序员,当你可以制造已经存在的方法(转换器)时,我的机器人很懒.

希望有人能向我解释如何使用这些转换器.

编辑:

在尝试回复后,我在加载usercontrol时遇到错误:

{"Cannot find resource named 'IntToVisibleConverter'. Resource names are case sensitive."}
Run Code Online (Sandbox Code Playgroud)

App.xaml中

<Application x:Class="Smartp1ck.JungleTimerClient.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:msconv="clr-namespace:Microsoft.TeamFoundation.Controls.WPF.Converters;assembly=Microsoft.TeamFoundation.Controls">
    <Application.Resources>
        <msconv:IntToVisibleConverter x:Key="IntToVisibleConverter" />
    </Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)

并在用户控制上

<TextBlock Text="{Binding TimeLeft}" HorizontalAlignment="Center" Visibility="{Binding Path=TimeLeft, Converter={StaticResource IntToVisibleConverter}}" />
Run Code Online (Sandbox Code Playgroud)

EDIT2:

在usercontrol的Resources中设置它使它工作.太糟糕我不能使用app.xaml由于某种原因我以后会把它弄清楚.谢谢你的帮助,解决了!

格言

c# wpf converter mvvm

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

双向绑定不使用带有angularjs的模态(子控制器)中的变量

您好我有一个产品列表,我希望人们选择其中一个,然后一个模态显示他们可以输入额外的信息(评论).我正在使用'AngularJS'与'Angular-UI'和'Angular-UI-bootstrap'.我想我能够如何使用http://angular-ui.github.io/bootstrap/#/modal上给出的示例,但是我似乎无法保存评论.它始终保持"请输入评论".这是代码:

模态模板:

   <script type="text/ng-template" id="orderModal">
        <div class="modal-header">
            <h3>Title</h3>
        </div>
        <div class="modal-body">
            <div class="alignleft">{{Product.Naam}}</div>
            <div class="alignright">€{{Product.Prijs}}</div>
            <div style="clear: both;"></div>
            <p>Heeft u een nog opmerking bij dit product?</p>
            <input type="text" name="Comment" ng-model="Comment" />
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" ng-click="ok()">Toevoegen</button>
            <button class="btn btn-warning" ng-click="cancel()">Annuleren</button>
        </div>
    </script>
Run Code Online (Sandbox Code Playgroud)

这是控制器:

productModule.controller("ProductsController", function ($scope, bootstrappedData, $modal, $log) {
    $scope.products = bootstrappedData.products;

    ...
    $scope.AddNormalOrder = function (product) {
            ....
    };

    $scope.OpenModal = function (product)
    {
        var modalInstance = $modal.open({
            templateUrl: 'orderModal',
            controller: ModalInstanceCtrl,
            resolve: { …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-ui angularjs-scope angular-ui-bootstrap

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

转换为List <T>以返回功能

所以我试图创建一个返回数据列表的函数,数据有很多"子"类,其中一个是注释但是,如果日期的类型是注释(我用IF语句测试)那么我想orderby编辑日期而不是id(ID在所有数据对象上都可用,而编辑日期仅在评论类中可用).所以,而不是做TypeOf我做TypeOf然后我能够在编辑日期订购它然而,它想要返回一个List然后我需要它作为一个List,但是我已经google了一个小时+没有运气找到关于如何转换它.这是方法:

private List<T> GetAllData<T>() where T : Data, new()
    {
        List<T> TmpList = new List<T>();
        if (typeof(T) == typeof(Comment))
        {
            TmpList = _newdb.Data.OfType<Comment>().OrderBy(x => x.EditDate).ToList();
            // THIS ABOVE doesn t work ofc since it wants to return a List<Comment> but TmpList is a List<T>

            //List<Comment> TmpComments = _newdb.Data.OfType<Comment>().OrderBy(x => x.EditDate).ToList();
            // List<T> tempzor = new List<T>(TmpComments.ToList());
            //TmpList = (List<T>(TmpComments));
            // TmpList = TmpComments.ConvertAll;
        }
        else
        {
            TmpList = _newdb.Data.OfType<T>().OrderBy(x => (x.Id)).ToList();
        }
        return TmpList;
    }
Run Code Online (Sandbox Code Playgroud)

提前致谢!

c# inheritance function list

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