小编Tom*_*Tom的帖子

实体框架6错误serverversion:(System.Data.SqlClient.SqlConnection)customerOrderContext.Database.Connection).ServerVersion

我正在实现一个web api,它将使用实体框架6获取数据.我正在使用Sql Server 2014和visual studio 2015.While调试CustomerDao类中的代码我在customerOrderContext对象中看到一个异常,虽然我可以看到记录在客户对象中.然而,在使用块执行后,我无法看到任何记录.

((System.Data.SqlClient.SqlConnection)customerOrderContext.Database.Connection).ServerVersion

CustomerDao

using (var customerOrderContext = new Entities())
                {
                    return (from customer in customerOrderContext.Customers

                            select new CustomerOrder.BusinessObjects.Customers
                            {
                                Id = customer.Id,
                                FirstName = customer.FirstName,
                                LastName = customer.LastName,
                                Address = customer.Address,
                                City = customer.City,
                                Email = customer.Email,
                                Gender = customer.Gender,
                                State = customer.State,
                                Zip = customer.Zip
                            }).ToList();
                }
Run Code Online (Sandbox Code Playgroud)

配置文件中的连接字符串如下所示

<add name="Entities" connectionString="metadata=res://*/EF.CustomerOrderContext.csdl|res://*/EF.CustomerOrderContext.ssdl|res://*/EF.CustomerOrderContext.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=Tom-PC\MSSQLSERVER2014;initial catalog=Ransang;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
Run Code Online (Sandbox Code Playgroud)

上下文类如下

public partial class Entities : DbContext
{
    public Entities()
        : base("name=Entities")
    {
    }

    protected override …
Run Code Online (Sandbox Code Playgroud)

.net c# entity-framework asp.net-web-api entity-framework-6

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

_this.form.get不是angular4中的函数

我开发一个角度4应用程序,并在将数据绑定到表单时遇到问题.绑定代码似乎很好,不知道问题是什么.当我调试应用程序时,我可以看到结果正确填充了下面的代码行this.editMovieForm = result; 在setFormValues()方法中.当我检查控制台窗口时,我看到以下错误

EditmovieComponent.html:1 ERROR TypeError: _this.form.get is not a function
    at forms.es5.js:4907
    at Array.forEach (<anonymous>)
    at FormGroupDirective.webpackJsonp.../../../forms/@angular/forms.es5.js.FormGroupDirective._updateDomValue (forms.es5.js:4906)
    at FormGroupDirective.webpackJsonp.../../../forms/@angular/forms.es5.js.FormGroupDirective.ngOnChanges (forms.es5.js:4774)
    at checkAndUpdateDirectiveInline (core.es5.js:10840)
    at checkAndUpdateNodeInline (core.es5.js:12341)
    at checkAndUpdateNode (core.es5.js:12284)
    at debugCheckAndUpdateNode (core.es5.js:13141)
    at debugCheckDirectivesFn (core.es5.js:13082)
    at Object.eval [as updateDirectives] (EditmovieComponent.html:1)


ERROR Error: Uncaught (in promise): TypeError: _this.editMovieForm.patchValue is not a function
TypeError: _this.editMovieForm.patchValue is not a function
    at main.bundle.js:446
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.bundle.js:2908)
    at Object.onInvoke (vendor.bundle.js:146628)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.bundle.js:2907)
    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (polyfills.bundle.js:2658)
    at polyfills.bundle.js:3389
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.bundle.js:2941)
    at …
Run Code Online (Sandbox Code Playgroud)

angular angular-reactive-forms angular4-forms

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

HostListener onBlur 和 onFocus 没有在 angular4 中被触发

我在 angular 4 中编写了一个指令,用于捕获 onFocus 和 onBlur。我可以看到我的指令在加载表单时被初始化,但是当我单击输入控件时没有看到 obBlur 或 Onfocus 触发。不知道出了什么问题。我在输入元素上设置了 ShortNumberFormatterDirective

指示

import { Directive, HostListener, ElementRef, OnInit } from "@angular/core"; 
//import { MyCurrencyPipe } from "./my-currency.pipe"; 


 @Directive({ selector: "[shortNumberFormatter]" }) 
 export class ShortNumberFormatterDirective implements OnInit { 


   private el: HTMLInputElement; 


   constructor( 
     private elementRef: ElementRef, 
    // private currencyPipe: MyCurrencyPipe 
   ) { 
     this.el = this.elementRef.nativeElement; 
   } 


   ngOnInit() { 
     //this.el.value = this.currencyPipe.transform(this.el.value); 
   } 


   @HostListener("focus", ["$event.target.value"]) 
   onFocus(value) { 
     //this.el.value = this.currencyPipe.parse(value); // opossite of transform 
   } 


   @HostListener("blur", ["$event.target.value"]) 
   onBlur(value) { 
     //this.el.value = this.currencyPipe.transform(value); …
Run Code Online (Sandbox Code Playgroud)

angular

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

highcharts-angular:无法读取未定义的属性"图表"

我试图在我的角度应用程序中实现highcharts-angular(https://github.com/highcharts/highcharts-angular)并得到以下错误

Cannot read property 'chart' of undefined
at HighchartsChartComponent.updateOrCreateChart (highcharts-chart.component.ts:35)
Run Code Online (Sandbox Code Playgroud)

我想使用bellcurve模块,但我无法使用它.

我试图使用stackblitz重新创建我的问题

请参阅https://stackblitz.com/edit/angular-unf7pz

不确定是什么问题

highcharts angular

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

Angular 7:消除UI中列名称的索引

我已经在angular 7中实现了一个动态表。我正在显示列标题并垂直记录。如果您发现列标题已在组件中进行了硬编码。我目前正在渲染大约57列,我预见的问题是服务器中引入新列或列顺序更改时。当前的UI代码看起来与索引(即幻数)紧密相关。有没有更好的方法来处理UI呈现。

用户界面

<table class="fundClassesTable table-striped" border="1">
  <tr *ngFor="let c of ColumnNames">
    <th class="tableItem bold">{{ c }}</th>
    <ng-container *ngFor="let f of data">
         <ng-container *ngFor="let s of data1;">
             <ng-container *ngIf="f.Id == s.LegalParentClassId">  
      <td class="tableItem" *ngIf="c == ColumnNames[0]">{{f.Description}}</td>
      <td class="tableItem" *ngIf="c == ColumnNames[1]">{{f.AuditSummary}}</td>
      <td class="tableItem" *ngIf="c == ColumnNames[2]">{{f.Id}}</td>
    </ng-container>
     </ng-container> 
  </ng-container>

  </tr>
  </table>
Run Code Online (Sandbox Code Playgroud)

零件

public ColumnNames: string[] = ['Legal Class Name', 'Last Edited' , 'Legal Class ID',''];
Run Code Online (Sandbox Code Playgroud)

JSFiddle

https://jsfiddle.net/sm7fzjhq/3/

JSON格式

[{"LegalFundClassCommercialViewModel":{"Description":"Class B","AuditSummary":"skeeling Jun 11, 2018","FeesReviewSummary":"","TermsReviewSummary":"","Id":11166,"FundId":5508,"FundClassType":1,"CurrencyId":null,"PrimaryCurrencyName":null,"OtherCurrencyName":"","ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":null,"SubVotingName":null,"SubHotIssueId":null,"SubHotIssueName":null,"RedsFrqncyId":5,"RedsFrqncyName":"Quarterly","RedsNoticeDays":45,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","LockupTypeId":null,"LockupTypeName":null,"HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":null,"SoftDurationMonthsName":null,"LockupFees0To12Pct":3,"LockupFees12To24Pct":null,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.03|","LockupComments":null,"ApplyGateDecliningBalance":false,"GateInvestorPct":null,"GateSourceId":null,"GateSourceName":null,"GateFundClassPct":null,"IntialProceeds":null,"PaymentInDays":null,"PaymentTypeOfDaysId":null,"PaymentTypeOfDaysName":null,"HoldbackPercentage":null,"HoldbackPayment":null,"HoldbackTypeOfDaysId":null,"HoldbackTypeOfDaysName":null,"ManagementFeeRate":null,"IncentiveFeeRate":null,"RealizationFrequencyId":null,"RealizationFrequencyName":null,"HighWaterMarkId":null,"HighWaterMarkName":null,"HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":null,"FeeReductionsNegotiated":null,"InvestmentStatusId":0,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A","AuditSummary":"skeeling Jun 11, 2018","FeesReviewSummary":"","TermsReviewSummary":"","Id":11167,"FundId":5508,"FundClassType":1,"CurrencyId":null,"PrimaryCurrencyName":null,"OtherCurrencyName":"","ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":null,"SubVotingName":null,"SubHotIssueId":null,"SubHotIssueName":null,"RedsFrqncyId":5,"RedsFrqncyName":"Quarterly","RedsNoticeDays":45,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","LockupTypeId":null,"LockupTypeName":null,"HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":null,"SoftDurationMonthsName":null,"LockupFees0To12Pct":3,"LockupFees12To24Pct":null,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.03|","LockupComments":null,"ApplyGateDecliningBalance":false,"GateInvestorPct":null,"GateSourceId":null,"GateSourceName":null,"GateFundClassPct":null,"IntialProceeds":null,"PaymentInDays":null,"PaymentTypeOfDaysId":null,"PaymentTypeOfDaysName":null,"HoldbackPercentage":null,"HoldbackPayment":null,"HoldbackTypeOfDaysId":null,"HoldbackTypeOfDaysName":null,"ManagementFeeRate":null,"IncentiveFeeRate":null,"RealizationFrequencyId":null,"RealizationFrequencyName":null,"HighWaterMarkId":null,"HighWaterMarkName":null,"HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":null,"FeeReductionsNegotiated":null,"InvestmentStatusId":0,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A","AuditSummary":"rmenon …
Run Code Online (Sandbox Code Playgroud)

angular

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

在分发文件夹中看不到 Angular 环境文件

我有一个 Angular 8 应用程序并测试在 environment.ts 文件中设置的超时。我目前已将超时设置为 6 分钟。我有两个环境文件,即 environment.ts 和 enviornment.prod.ts。我相信执行 ng build --prod 时会使用 environment.prod.ts 。

运行 ng build 命令后,我无法在分发文件夹中找到环境文件。有人可以告诉我在哪里可以找到它吗?它是在某些二进制文件中吗?

这就是我的环境文件的样子

// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = …
Run Code Online (Sandbox Code Playgroud)

environment angular

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

Jasmine 测试:预期是 SPY,但出现功能错误

我使用 Jasmine 编写了一个角度分量测试并出现错误。我基本上想测试当调用 ngOnchanges 时是否调用 loadPersonNotes

ComplianceNoteComponent should call getPersonNote FAILED
        Error: <toHaveBeenCalled> : Expected a spy, but got Function.
        Usage: expect(<spyObj>).toHaveBeenCalled()
            at <Jasmine>
Run Code Online (Sandbox Code Playgroud)

我不知道它为什么抱怨

茉莉花测试

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { of, Observable } from 'rxjs';
import { configureTestSuite } from 'ng-bullet';
import { DxButtonModule } from 'devextreme-angular';
import { NgxPermissionsModule } from 'ngx-permissions';

import { SharedFontAwesomeModule } from '../../../../shared/shared-font-awesome.module';
import { UserService } from '../../../../shared/services/user.service';
import { ComplianceNoteComponent } from './compliance-note.component';
import { IPersonNote …
Run Code Online (Sandbox Code Playgroud)

jasmine angular

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

类型“ SharedArrayBuffer”不可分配给“ ArrayBuffer”类型

我已将应用程序从4号角升级到6号角。出现以下错误。错误是在行返回data.buffer处。这是es兼容性问题吗?

error TS2322: Type 'ArrayBuffer | SharedArrayBuffer' is not assignable to type 'Arr
ayBuffer'.
  Type 'SharedArrayBuffer' is not assignable to type 'ArrayBuffer'.
    Types of property '[Symbol.toStringTag]' are incompatible.
      Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'.
Run Code Online (Sandbox Code Playgroud)

serialize(): ArrayBuffer {
        let source: ArrayLike<number>[] = this.contents.map(o => new Uint8Array(o));
        let lengths = source.map(o => this.numToArr(o.length));
        if (!!this.value) {
            const bytes = utf8.toByteArray(JSON.stringify(this.value, null, null));
            const dataLength = this.numToArr(bytes.length);
            source = [bytes, ...source];
            lengths = [dataLength, ...lengths];
        }

        const totalLength = source.reduce((acc, …
Run Code Online (Sandbox Code Playgroud)

angular

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

需要使用角度在 ag-grid 的页脚中显示总值

我目前正在我的 Angular 7 应用程序中实现 ag-grid。我需要包含我所取得的每个组的页脚。我现在需要显示 EMV(USD) 总计和百分比列,如下面的屏幕截图所示。除提到的两列外,每个单元格的行应为空白,并且应显示总计

在此输入图像描述

成分

import { Component, Injectable, NgZone, ViewEncapsulation, ViewChild, Input } from '@angular/core';
import { OnInit } from '@angular/core';
import { AllocationsService } from '../services/allocations.service';
import { formatDate } from '@angular/common';
import { GridOptions } from 'ag-grid-community/dist/lib/entities/gridOptions';
import { Comparator } from '../utilities/comparator';
import { ActivatedRoute } from '@angular/router';
import { TestBed } from '@angular/core/testing';


@Component({
    selector: 'mgr-allocations',
    templateUrl: './allocations.component.html'
})


export class AllocationsComponent implements OnInit {

    private Error: string;
    public evalDate: Date;
    private …
Run Code Online (Sandbox Code Playgroud)

ag-grid angular

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

colspan 未应用于表的列

我正在 Angular 应用程序中构建一个 UI,需要对下面屏幕截图中突出显示的名为 Subscriptions 的列进行 colspan。我尝试应用 colspan 但似乎没有效果。

在此输入图像描述

我需要的是这样的东西

在此输入图像描述

网页

        <tr>
            <th class="tableItem bold">Legal Class Name</th>
            <th class="tableItem bold">Last Edited</th>
            <th class="tableItem bold">Legal Class ID</th>
            <th class="tableItem bold"></th>
            <th class="tableItem bold">TERMS</th>
            <th class="tableItem bold">SUBSCRIPTIONS</th>
            <th class="tableItem bold">Primary Currency</th>

        </tr>



        <ng-container>
            <!-- <tr *ngFor="let f of fundClass['LegalFundClassDetailsViewModel'] | keyvalue"> -->
            <tr *ngFor="let f of LegalFundClasses.LegalFundClassDetailsViewModel">
                <td class="tableItem">{{f.Description}}</td>
                <td class="tableItem"></td>
                <td class="tableItem">{{f.Id}}</td>
                <td class="tableItem"></td>
                <td class="tableItem"></td>
                <td colspan="5" class="tableItem"></td>
                <td class="tableItem"> 
                    <kendo-dropdownlist style="width:100%" [(ngModel)]="f.CurrencyId"
                     class="form-control  form-control-sm" [data]="Currencies"
                     [filterable]="false" textField="CURRENCY_NAME" [valuePrimitive]="true" valueField="CURRENCY_ID"> …
Run Code Online (Sandbox Code Playgroud)

html angular

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