小编Cha*_*ris的帖子

postgres逃脱角色

我是postgres的新手,如何在where子句的MESSAGE参数中转义RTF语法?

select count(*) 
from communicationoutgoingmessagescheduledetails 
where email='chris.green@waynesreaves.com' 
and message='{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}}{\colortbl\red0\green0\blue0 ;\red0\green0\blue255 ;}{\*\listoverridetable}{\stylesheet {\ql\cf0 Normal;}{\*\cs1\cf0 Default Paragraph Font;}{\*\cs2\sbasedon1\cf0 Line Number;}{\*\cs3\ul\cf1 Hyperlink;}}\splytwnine\sectd\pard\plain\ql{\cf0 first }{\b\cf0 paymen}{\b\cf0 t bold }{\cf0 rem}{\cf0 inder}\par\pard\plain\ql{\ul\cf0 se}{\ul\cf0 cond PAYMENT }{\b\ul\cf0 reminder}\b\ul\par}' 
and succeddful=-1 
and senttime::timestamp::date='2/7/2013 12:00:00 AM'
Run Code Online (Sandbox Code Playgroud)

更新

这是我得到的错误

WARNING:  nonstandard use of escape in a string literal LINE 4: and message='{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}}{\c...

HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'. 
ERROR:  invalid Unicode escape LINE 4: and message='{\rtf1\deff0{\fonttbl{\f0 Times …
Run Code Online (Sandbox Code Playgroud)

postgresql

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

保存客户端html更改

我有一个div元素,其中包含一个ul元素,该元素在首次加载页面时从空开始.然后,用户可以将li元素拖到此div框中,该div框将填充ul元素.我需要能够保留已添加到ul容器中的li元素,以便我可以在回发后显示li元素.我怎样才能做到这一点?

<div class="sidebar-drop-box">              
                 <p class="dropTitle"><strong>Drop Box</strong><br />  
                     Drag and drop tracks here temporarily if you’re working with a long playlist.</p>  
                 <ul class="admin-song-list"></ul>  
         </div>
Run Code Online (Sandbox Code Playgroud)

使用javascript和jquery完成拖放操作.所有这些都在asp.net页面上.拖动完成后,这是执行的代码

function AddToDropBox(obj) {
    $(obj).children(".handle").animate({ width: "20px" }).children("strong").fadeOut();
    $(obj).children("span:not(.track,.play,.handle,:has(.btn-edit))").fadeOut('fast');
    $(obj).children(".play").css("margin-right", "8px");
    $(obj).css({ "opacity": "0.0", "width": "284px" }).animate({ opacity: "1.0" });
    if ($(".sidebar-drop-box ul").children(".admin-song").length > 0) {
        $(".dropTitle").fadeOut("fast");
        $(".sidebar-drop-box ul.admin-song-list").css("min-height", "0");
    }
    if (typeof SetLinks == 'function') {
        SetLinks();
    }
Run Code Online (Sandbox Code Playgroud)

所以我尝试下面的代码来完成并获取所有假设在下拉框中的元素并将它们放回去.但它没有将它们添加到下拉框中,它对主列表进行了更改

//repopulate drop box
    if(document.getElementById("ctl00_cphBody_hfRemoveMedia").value!="")
        {
            var localRemoveMedias=document.getElementById("ctl00_cphBody_hfRemoveMedia").value.split(",");
            $(".admin-left li.admin-song").each(function(){
//                alert("inEach");//WORKS
                for(x in localRemoveMedias)
                {
                    if($(this).attr("mediaid")==localRemoveMedias[x])
                    { …
Run Code Online (Sandbox Code Playgroud)

asp.net postback

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

CQRS中单个进程的多个命令

我有CQRS + ES设计的应用程序.这是我新的CQRS + ES世界在过去一年中一直在阅读它并且它非常有意义,但实现完美的感觉并不容易.

无论如何,我的问题是:

包含多命令(步骤)过程的最佳方法是什么?即注册用户这些是我想在该过程中触发的命令:

  1. CreateUserProfileCommand
  2. CreatePaymentAccountCommand
  3. SendEmailAddressVerificationCommand

我看过Saga,他们看起来更开始和停止然后这个过程都是连续的.

当然,链接事件的步骤可能导致重播噩梦.

更新 @EbenRoux
要添加更多信息,CreatePaymentAccount实际上应该命名为UpdateUserWithPpaymentAccount.我看到命名中的混乱.这个命令实际上是什么让第三方得到了一个附加给用户的PaymentCustomerId.

我得到你对佐贺的看法,我想知道这个过程是否需要.

现在这个应用程序正在进行中所以所有业务上下文(我假设你是BC的意思)没有一个端点pub/sub立场.我想到达那里.

cqrs event-sourcing

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

使用ajax请求刷新html.renderaction

我有div在我的页面上呈现图像库

        <div id="gallery">       
    @{
        Html.RenderAction("UserGallery");
     }
Run Code Online (Sandbox Code Playgroud)

我有这个功能,它在成功上传新图像时运行

        function filesUploadOnSuccess(e) {
            function updateCart() {
                //var tdata = $(frm).serialize(); 
                // or your data in the format that will be used ??
                $.ajax({
                    type: "GET",
                    //data: tdata,
                    url : '@Url.Action("UserGallery")',
                    dataType: "json",
                    success: function (result) { success(result); }
                });
            };
        }

        function success(result) {
            $("#gallery").html(result);
        }
Run Code Online (Sandbox Code Playgroud)

问题是画廊div没有得到更新.

jquery renderaction asp.net-mvc-4

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

Azure Service Bus主题多个订阅者

我是Azure Service Bus的新手,想知道我是否可以将多个订阅者添加到队列或主题中?在Rabbit MQ中,我可以拥有1个发布者的多个订阅者.

我想要做的是,我正在使用CQRS,当某些命令在处理事件时进入系统时,我想将它们推入消息队列.

我希望2个订阅者能够从该队列中获取消息,其中一个用于我内部处理.另一个用于处理并向外发送.

c# azure azureservicebus

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

Xamarin Forms、Sqlite、EF Core 3、迁移和很多混乱

我有一个 Xamarin Forms 应用程序,我已经从只使用Restful API 切换到使用本地 SQLite DB,它将使用这个Dotmim.Sync - DB Sync'ing Framework(这很棒!)进行同步。我在 Xamarin 表单项目中使用 EF Core 3 与 SQLite 进行交互。

我的问题是关于在 SQLite 上运行迁移或只是数据库更新。我已经阅读了几个关于不同方法的博客和论坛,但它们都已经有几年的历史了,从 EF Core 1 到 EF Core 2,还有很多工作要做。

  1. https://forums.xamarin.com/discussion/101805/xamarin-android-entity-framework-core-2-and-migrations - 这讨论了通过添加控制台应用程序运行迁移
  2. https://medium.com/@yostane/entity-framework-core-and-sqlite-database-migration-using-vs2017-macos-28812c64e7ef - 此添加是Dot Net Cli 工具参考。我试过这个并得到错误,但它也是 EF Core 1.1
  3. https://www.algoworks.com/blog/xamarin-forms-and-entity-framework-core/ - 给了我更多的问题然后是答案。

还有更多的链接,但我,这些证明了我对所有不同方法的观点。

我想要实现的是:

  1. 当用户打开应用程序时,它会检查是否有数据库版本更新,或者应用程序已更新并知道它必须更新数据库。
  2. 当有数据库更新时,Dotmim.Sync 框架控制在客户端 (Xamarin Forms) 上预配和取消预配数据库。这提供了运行 EFCore 迁移或 SQL Sricpts 来更新 SQLite 存储的机会。

选项 1 我想采用 EF Core 迁移路径,因为主数据库已使用迁移更新,应用程序将能够利用相同的脚本。如果在运行时在 Xamarin 表单上运行迁移是可能的,那就太好了。

Q1。EF Core 是否可以在运行时在 Xamarin …

sqlite database-migration xamarin.forms entity-framework-core ef-core-3.0

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

"汇编"中的类型''未标记为可序列化.LINQ到SQL

我正在使用asp.net并已将会话配置为存储在SQL Server中.我的项目有很多对象和几个linq-to-sql dbml.我已将所有这些配置为单向序列化,并进行了一些自定义更改.

当我运行应用程序时,我在application_error事件处理程序中不断收到此错误

在程序集'App_Code.thzd8p2j中输入'Data.Karaoke.spCWP_SelUserPrivilegesResult',Version = 0.0.0.0,Culture = neutral,PublicKeyToken = null'未标记为可序列化.

从错误中我不确定它是否来自dbml.designer.cs文件,这是代码:

[Function(Name="dbo.spCWP_SelUserPrivileges")]
public ISingleResult<spCWP_SelUserPrivilegesResult> spCWP_SelUserPrivileges([Parameter(Name="IDCWPUser", DbType="Int")] System.Nullable<int> iDCWPUser)
{
  IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), iDCWPUser);
  return ((ISingleResult<spCWP_SelUserPrivilegesResult>)(result.ReturnValue));
}
Run Code Online (Sandbox Code Playgroud)

[DataContract()]
public partial class spCWP_SelUserPrivilegesResult
{

  private int _IDTypeCWPModule;

  private string _TypeKey;

  private bool _Security;

  public spCWP_SelUserPrivilegesResult()
  {
  }

  [Column(Storage="_IDTypeCWPModule", DbType="Int NOT NULL")]
  [DataMember(Order=1)]
  public int IDTypeCWPModule
  {
    get
    {
      return this._IDTypeCWPModule;
    }
    set
    {
      if ((this._IDTypeCWPModule != value))
      {
        this._IDTypeCWPModule = value;
      }
    }
  }

  [Column(Storage="_TypeKey", DbType="VarChar(10) NOT NULL", …
Run Code Online (Sandbox Code Playgroud)

c# sql-server linq-to-sql asp.net-session

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

运行Linq语句的超时异常

这才刚刚开始发生.这个声明已经工作了几个月,现在我只是继续得到下面的超时错误.当我直接在SSMS上执行相同的语句时,它会在一秒钟内返回.该表有44k记录,并且是5列状态的索引,其中一列是其中之一.

select distinct(state) from [ZipCodeDatabase]
Run Code Online (Sandbox Code Playgroud)

我正在运行以下linq语句

states = ZipCodeRepository.Get(orderBy: z => z.OrderBy(o => o.State)).Select(z => z.State).Distinct().ToList();
Run Code Online (Sandbox Code Playgroud)

当我运行这个linq语句时,我不断得到一个超时错误并且不知道y因为它之前正常工作.

我包含了Get()一个通用的repo函数函数,但也许我在那里遗漏了一些东西,这导致了延迟.

获取功能:

public virtual IEnumerable<TEntity> Get(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "") //params Expression<Func<TEntity, object>>[] includes
{
    IQueryable<TEntity> query = dbSet;
    if (filter != null)
    {
        query = query.Where(filter);
    }
    foreach (var includeProperty in includeProperties.Split
        (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
    {
        query = query.Include(includeProperty);
    }

    if (orderBy != null)
    {
        return orderBy(query).ToList(); …
Run Code Online (Sandbox Code Playgroud)

c# sql linq entity-framework sql-server-2008

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

vsts将.net标准2打包到nuget中

我一直试图在VSTS构建过程中整天打包此nuget软件包。这是.net标准2.0项目

这是我不断得到的错误之一

Unable to cast object of type 'System.String' to type 'NuGet.Frameworks.NuGetFramework'.
Run Code Online (Sandbox Code Playgroud)

尝试打包时从控制台打印输出。

******************************************************************************
Starting: NuGet pack
******************************************************************************
==============================================================================
Task         : NuGet
Description  : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
Version      : 2.0.15
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================
C:\Windows\system32\chcp.com 65001
Active …
Run Code Online (Sandbox Code Playgroud)

nuget azure-devops .net-standard .net-standard-2.0

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

Sql Server行大小限制和表设计

我在SQL Server 2008上有这个查询

CREATE TABLE MediaLibrary
(
MediaId bigint NOT NULL IDENTITY (1, 1),
MediaTypeId smallint NOT NULL,
ImageNameByUser nchar(100) NULL,
GeneratedName uniqueidentifier NOT NULL,
UploadedByUserId uniqueidentifier NOT NULL,
UploadedDate date NOT NULL,
ProfilePhoto bit NOT NULL,
PublicPhoto bit NOT NULL,
AppointmentId bigint NULL,
OriginalImage nchar(1000) NULL,
ThumbImage nchar(1000) NULL,
MediumImage nchar(1000) NULL,
LargeImage nchar(1000) NULL,
UrlThumb nchar(1000) NULL,
UrlMedium nchar(1000) NULL,
UrlLarge nchar(1000) NULL,
InactiveReasonId smallint NULL,
InactiveDate datetime NULL
)  ON [PRIMARY]
GO
Run Code Online (Sandbox Code Playgroud)

当我尝试创建表时,我收到此错误

创建或更改表'MediaLibrary'失败,因为最小行大小为14273,包括9字节的内部开销.这超出了允许的最大表行大小8060字节.

我知道我在行大小上达到了限制,但这不是一张大表,所以我想知道这不是一个好的设计吗?

当我改变nchar(1000) …

sql-server database-design sql-server-2008-r2

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

MVC Identity 2使用FormsAuthenticationTicket

我正在用自定义版本替换(HttpContext.Current.User)IPrincipal,以便我可以存储更多信息登录和用户.我在使用FormsAuthtenticationTicket之前已完成此操作,但其他方式基于Memberhipship和SimpleMembership提供程序.

我的问题是,我可以使用FormsAuthenticationTicket来存储我的ICustomPrincipal的cookie,它会干扰或破坏OWIN Identity Pipline吗?我觉得我会混合苹果和橘子.

示例保存:

var user = userRepository.Users.Where(u => u.Email == viewModel.Email).First();

    CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel();
    serializeModel.UserId = user.Id;
    serializeModel.FirstName = user.FirstName;
    serializeModel.LastName = user.LastName;

    JavaScriptSerializer serializer = new JavaScriptSerializer();

    string userData = serializer.Serialize(serializeModel);

    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
             1,
             viewModel.Email,
             DateTime.Now,
             DateTime.Now.AddMinutes(15),
             false,
             userData);

    string encTicket = FormsAuthentication.Encrypt(authTicket);
    HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
    Response.Cookies.Add(faCookie);
Run Code Online (Sandbox Code Playgroud)

示例检索:

protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
{
    HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];

    if (authCookie != null)
    {
        FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

        JavaScriptSerializer …
Run Code Online (Sandbox Code Playgroud)

forms-authentication asp.net-mvc-5 asp.net-identity-2

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

不重复代码的构造函数

我有2个构造函数,其中有一个基本调用;

public MyApplication(myEntities context)
            :base(context)
{
    _1stApp = new 1stApplication(this._context);
    _2ndApp = new 2ndApplication(this._context);
    // etc...
}

public MyApplication()
            :base()
{
    _1stApp = new 1stApplication(this._context);
    _2ndApp = new 2ndApplication(this._context);
    // etc...
}
Run Code Online (Sandbox Code Playgroud)

以及基础构造函数

public BaseApplication()
{
    _context= new myEntities ();
}

public BaseApplication(myEntities context)
{
    if (context==null)
        _context = context;
    else
        _context= new myEntities ();
}
Run Code Online (Sandbox Code Playgroud)

在MyApplication构造函数中,我想要传递由另一个应用程序创建的上下文,或者我想创建一个新的上下文.在任何一种情况下,我都希望与MyApplication实例化的所有其他应用程序类(1stApp,2ndApp等)共享相同的上下文.

我不想在两个地方保持相同的代码.

c#

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