小编Off*_*'er的帖子

如何阻止VS2015将my.csproj转换为.sqlproj?

我有一个旧的解决方案,我正在尝试使用其中的当前项目构建一个新的解决方案.其中一个项目是SQLUtils,它只包含.cs文件,而它的Target框架.NET Framework 2.0.

在旧的解决方案中,它是一个常规的C#类库项目,但是当我将它添加到我的新解决方案时,它变成.sqlproj并且在构建它时出现错误.

我试着像旧的那样编辑新的.sln,但这没有任何区别.

我查看了https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38113dcd-caaa-4704-ad69-d7ce774d2916/sql-server-data-tools-september-edition-migration-issues-vs2010 ?论坛= SSDT

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0f537da4-9d61-45bf-8778-102eae9d4b83/csproj-to-sqlproj-migration-in-vs2012-with-ssdt?forum= SSDT

但他们并没有完全解决它,你知道MSDN ...

其他信息: 解决方案文件:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "BO 25.7.17", "BO 25.7.17", "{5C12D821-9F39-4C47-A888-DD65E5CD6464}"
    ProjectSection(WebsiteProperties) = preProject
        SccProjectName = "SAK"
        SccAuxPath = "SAK"
        SccLocalPath = "SAK"
        SccProvider = "SAK"
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv2.0"
        ProjectReferences = "{f977dcec-ed6c-485f-ab12-1fe31b7cbc5c}|Logic.dll;"
        Debug.AspNetCompiler.VirtualPath = "/localhost_61694"
        Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\TFS\StyleRiver\BO\BO 25.7.17\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_61694\"
        Debug.AspNetCompiler.Updateable = …
Run Code Online (Sandbox Code Playgroud)

.net c# csproj visual-studio-2015

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

Facebook 页面嵌入 iframe 不会填充容器宽度

我添加了维基百科的 iframe 来演示我遇到的问题。
Wiki iframe 像它想象的那样正确显示,但 facebook iframe 不是。

在此处输入图片说明 在此处输入图片说明

HTML:

   <div class="iframe-fb-container mt-4">
      <iframe class="iframe-fb" width="450" height="700" style="border:1px solid black;overflow:hidden" scrolling="yes" frameborder="0" allowTransparency="true" allow="encrypted-media" src="https://www.facebook.com/plugins/page.php?href=https://www.facebook.com/Microsoft/&tabs=timeline%2Cevents%2Cmessages&width=450px&height=700px&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=2235597906716847"></iframe>
      <iframe class="iframe-fb" width="450" height="700" style="border:1px solid black;overflow:hidden" scrolling="yes" frameborder="0" allowTransparency="true" allow="encrypted-media" src="https://fr.wikipedia.org/wiki/Main_Page"></iframe>
   </div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.iframe-fb-container {
    border: 1px solid blue;
 }

 .iframe-fb {
    width: 100%;
    }
Run Code Online (Sandbox Code Playgroud)

如您所见,我向 facebook 询问了一个宽度为450px的 iframe,并且在附加的图像中,模拟器的宽度为375px,但 fb iframe 仍然没有像维基百科 iframe 那样填充它的容器。

我怎样才能让 fb iframe 填充它的容器?

html css facebook facebook-like

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

.Net core X-Forwarded-Proto 标头未正确传递到 Nginx

抱歉编辑历史记录,但这个问题对我来说真的不清楚,很难找到确切的问题。

我有一个在Nginx后面运行的.Net-Core Web 应用程序,并且X-Forwarded-Proto总是通过而不是.httphttps

启动.cs

 public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<ForwardedHeadersOptions>(options =>
            {
                options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
            });

            services.AddMvc();

        }

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            //first middlewear
            app.UseForwardedHeaders();
             //and the rest
         }
Run Code Online (Sandbox Code Playgroud)

Nginx 配置

server {
    listen        80;
    server_name   example.com;
    location / {
        proxy_pass         http://localhost:5001/;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}
Run Code Online (Sandbox Code Playgroud)

Nginx.conf

http {
    include …
Run Code Online (Sandbox Code Playgroud)

nginx http-headers .net-core asp.net-core

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

引用外键并为父表中的列添加检查约束

如何在表中添加BusinessCategories相关列IsBusinessCategory值是否为“真”的检查Categories.ID

CREATE TABLE [dbo].[Categories](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ParentID] [int] NULL,
    [DisplayNameHe] [nvarchar](400) NOT NULL,
    [DisplayNameEn] [nvarchar](400) NOT NULL,
    [DisplayNameEs] [nvarchar](400) NOT NULL,
    [CreateDate] [datetime] NOT NULL,
    [Status] [bit] NOT NULL,
    [IsBusinessCategory] [bit] NULL
)



CREATE TABLE [dbo].[BusinessCategories](
    [ID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
    [BusinessCategoryID] [INT] NOT NULL REFERENCES Categories(ID) -- Need to check that is 
     businessCategory ==1
    [BusinessID] [INT] NOT NULL REFERENCES Business(ID)
)
Run Code Online (Sandbox Code Playgroud)

目标是能够仅将具有IsBusinessCategory == true 的Categories表中的值插入到列 …

sql sql-server

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

.Net Core:nvalidOperationException:在配置上下文时尝试使用上下文

我尝试并行运行 6 个任务,但每隔一段时间就会收到此错误:

InvalidOperationException:尝试在配置上下文时使用该上下文。实例DbContext无法在内部使用,OnConfiguring因为此时它仍在配置中。如果在前一个操作完成之前在此上下文上启动第二个操作,则可能会发生这种情况。不保证任何实例成员都是线程安全的。Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()

启动.cs

services.AddDbContext<myDbContext>(options => options.UseSqlServer(_config.GetConnectionString("DefaultConnection")));
Run Code Online (Sandbox Code Playgroud)

我用于当前任务的服务:

services.AddScoped<IPostService, PostService>();
services.AddScoped<IPartnerService, PartnerService>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddScoped<IRelatedRepository, RelatedRepository>();
services.AddSingleton<ICookieRepository, CookieRepository>();
Run Code Online (Sandbox Code Playgroud)

我尝试运行任务并获得异常的方式:

var relatedTipsTask = Task.Run(() => GetRelatedTipsVms(citiesIDs, countriesIDs, categoriesIDs, bigNumToTake, tipID));
////#1.2 Get related texts widgets
var relatedTextsTask = Task.Run(() => GetRelatedTextsVms(citiesIDs, countriesIDs, categoriesIDs, smallNumToTake, textID));
////#1.3 Get related partners widgets
var relatedPartnersTask = Task.Run(() => GetRelatedPartnersVms(smallNumToTake, partnerID));
////#1.4 Get related post widgets
var relatedPostsTask = Task.Run(() => GetRelatedPostsVms(citiesIDs, countriesIDs, smallNumToTake, postID));
////#1.5 Get related …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous async-await asp.net-core

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

如何在Safari私密模式的本地存储中保存

我有一个应用程序,用于在本地存储中保存用户名.它适用于所有浏览器,除了Safariprivate mode.

有没有办法在Safari私密模式下保存此变量?我尝试过使用cookies,但它也不起作用......

有什么工作吗?

cookies safari local-storage incognito-mode

4
推荐指数
2
解决办法
2651
查看次数

将表头与Firefox中的其他表主体对齐

使用Firefox时我有一个CSS问题,我不知道它究竟在哪里.

我有一个由2个表构建的表,它使用一个表Thead并填充第二个表tbody,然后它看起来像一个带有Fix Header的表,一切正常,直到FireFox破坏了聚会.

我在Firefox中查看表格奇怪: 在此输入图像描述 这就是THFireBug中最后一个元素(Last activated)的样子: 在此输入图像描述

Chrome中它看起来不错: 在此输入图像描述 这就是最后一次TH在Chrome中的表现: 在此输入图像描述

HTML:

<div class="modal-scrollable-table-wrapper">
                            <table style="border-left:0">
                                <thead class="fixed-header active-rules" data-table="activeRulesTable">
                                    <tr>
                                        <th data-sort="0">Status</th>
                                        <th data-sort="1">Name</th>
                                        <th data-sort="2">Action</th>
                                        <th data-sort="3">Condition</th>
                                        <th data-sort="4">Last activated</th>
                                    </tr>
                                </thead>
                            </table>

                            <div class="modal-scrollable-table-body">
                                <table id="activeRulesTable" class="cell-border">
                                    <thead style="display: none">
                                    </thead>
                                    <tbody>
                    //get the rows from the server and populates using js
                                    </tbody>
                                </table>
                            </div>
                        </div>
Run Code Online (Sandbox Code Playgroud)

CSS:

html {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
} …
Run Code Online (Sandbox Code Playgroud)

html css firefox

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

网站地址验证的正则表达式

我有一个用户输入来提供网站地址,显然大多数用户不知道什么是格式良好的网址,因此我寻找一个遵循以下规则的网站地址正则表达式:

1) www.someaddress.com -正确
2) someaddress.com -正确
3) http://someaddress.com -正确
4) https://someaddress.com -正确
5) https://www.someaddress.co。 il -正确
6) http://www.someaddress.com -正确

我使用这个正则表达式

[RegularExpression(@"^((http|ftp|https|www)://)?([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?$", ErrorMessage = "Not a valid website address")]
public string SiteUrl { get; set; }
Run Code Online (Sandbox Code Playgroud)

但这是没有用的,因为它几乎允许所有字符串通过。

请提供数据注释答案,而不是诸如以下的答案:

Uri.IsWellFormedUriString
Run Code Online (Sandbox Code Playgroud)

因为.net 不支持自定义属性的客户端验证。

.net c# regex data-annotations

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

使用Async-await时UI会冻结

我有这个功能冻结UI:

Public Sub ValidateUrlContentAsync(externalApplyURL As String)

    AsyncManager.OutstandingOperations.Increment()

    Dim result = Threading.Tasks.Task.
        Run( _
            Async Function()
                Return Await ValidateLinks.ValidateUrlContentAsync(externalApplyURL)
            End Function).
        ContinueWith(
            Sub(t)
                Try
                    If t.IsFaulted Then
                        Throw t.Exception
                    End If

                    If t.Result.Error IsNot Nothing Then
                        ErrorHandler.Log.Warn(
                            String.Format("ValidationError: {0}, Exception: {1}", externalApplyURL, t.Result.Error))
                    End If

                    AsyncManager.Parameters("validationResult") = t.Result.ResultValue.ToString()

                Finally
                    AsyncManager.OutstandingOperations.Decrement()
                End Try

            End Sub)

End Sub

 Public Function ValidateUrlContentCompleted(validationResult As String) As ActionResult

    Return Json(validationResult, JsonRequestBehavior.AllowGet)

End Function
Run Code Online (Sandbox Code Playgroud)

我认为这task.run解决了这个问题,因为它创建了一个与UI线程分离的新线程,这段代码出了什么问题?

vb.net asynchronous task-parallel-library async-await

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

如何在DataTable中上下移动一行?

我正在使用JavaScript库DataTables来显示数据.

我希望能够重新排序行.我看到有一个名为RowReorder的扩展程序,但它看起来很糟糕,因为即使在线发现的示例也没有对行重新排序(至少在撰写本文时最新版本的Chrome).即使它有效,我也不喜欢这种解决方案,因为您不能清楚地重新排序行.

所以我想实现如下图像:

DataTable重新排序

我在网上找到了几个链接要求,但似乎没有人可以使它正常工作.

我的数据源是一个简单的数组.还没有阿贾克斯.我想开始简单.

这是你之前做过的事吗?关于如何开始构建该功能的任何方向?

javascript jquery datatables

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