我在这个linq表达式中有这个错误:
var naleznosci = (from nalTmp in db.Naleznosci
where nalTmp.idDziecko == idDziec
select new Payments
(
nalTmp.Dziecko.Imie,
nalTmp.Dziecko.Nazwisko,
nalTmp.Miesiace.Nazwa,
nalTmp.Kwota,
nalTmp.RodzajeOplat.NazwaRodzajuOplaty,
nalTmp.RodzajeOplat.TypyOplat.NazwaTypuOplaty,
nalTmp.DataRozliczenia,
nalTmp.TerminPlatnosci
)).ToList();
Run Code Online (Sandbox Code Playgroud)
任何想法如何解决这个问题?我尝试任何表达式的组合......:/
class Parent {
public string A { get; set; }
}
class Child : Parent {
public string B { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我只需要获得属性B,没有属性A但是
Child.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
Run Code Online (Sandbox Code Playgroud)
返回两个属性:/
我有Visual Studio 2010的错误:
错误1在"Sources"参数中多次指定"CrossDomainService.svc.cs"项."Sources"参数不支持重复项.WcfServiceDomain
并从msbuild
C:\ Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(160,9):错误MSB3105:"Sources"参数中指定的项目"CrossDomainService.svc.cs"超过了oce ."Sources"参数不支持重复项.[C:\ inetpub\Wwwroot\axaptaWcfConnection\WcfServiceDomain\WcfSer viceDomain.csproj]
我的文件是csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8D40933A-E036-4CD0-9003-314A692724D5}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WcfServiceDomain</RootNamespace>
<AssemblyName>WcfServiceDomain</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup> …
Run Code Online (Sandbox Code Playgroud) 我有一个方法:
public DzieckoAndOpiekunCollection GetChildAndOpiekunByFirstnameLastname(string firstname, string lastname)
{
DataTransfer.ChargeInSchoolEntities db = new DataTransfer.ChargeInSchoolEntities();
DzieckoAndOpiekunCollection result = new DzieckoAndOpiekunCollection();
if (firstname == null && lastname != null)
{
IList<DzieckoAndOpiekun> resultV = from p in db.Dziecko
where lastname == p.Nazwisko
**select** new DzieckoAndOpiekun(
p.Imie,
p.Nazwisko,
p.Opiekun.Imie,
p.Opiekun.Nazwisko)
;
result.AddRange(resultV);
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
和选定位置的错误:
错误1无法将类型'System.Linq.IQueryable <WcfService1.DzieckoAndOpiekun>'隐式转换为'System.Collections.Generic.IList <WcfService1.DzieckoAndOpiekun>'.存在显式转换(您是否错过了演员?)
任何想法如何解决我的问题?
我创建自己的表类型
CREATE TYPE [dbo].[ObjectsList] AS TABLE(
[Id] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF)
)
GO
Run Code Online (Sandbox Code Playgroud)
当我想将此类型作为参数传递时
CREATE PROCEDURE [dbo].[GetData](@DataIds ObjectsList READONLY)
Run Code Online (Sandbox Code Playgroud)
我应该如何在EXEC GetData中传递它?
我有以下枚举:
public enum SymbolWejsciowy
{
K1 , K2 , K3 , K4 , K5 , K6 , K7 , K8
}
Run Code Online (Sandbox Code Playgroud)
我想使用此枚举的值创建一个列表:
public List<SymbolWejsciowy> symbol;
Run Code Online (Sandbox Code Playgroud)
我尝试了几种不同的方法将枚举值添加到列表中:
SymbolWejsciowy symbol;
symbol.Add(symbol = SymbolWejsciowy.K1);
Run Code Online (Sandbox Code Playgroud)
和
symbol.Add(SymbolWejsciowy.K1);
Run Code Online (Sandbox Code Playgroud)
但是,我总是得到以下异常:
你调用的对象是空的.
我怎样才能正确地完成这个?
我有索引视图:
@using System.Web.Mvc.Html
@model MsmqTestApp.Models.MsmqData
<!DOCTYPE html>
<html>
<head>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<meta name="viewport" content="width=device-width" />
<title>MsmqTest</title>
</head>
<body>
<div>
<input type="submit" id="btnBuy" value="Buy" onclick="location.href='@Url.Action("BuyItem", "MsmqTest", new { area = "Msmq" })'" />
<input type="submit" id="btnSell" value="Sell" onclick="location.href='@Url.Action("SellItem", "MsmqTest", new { area = "Msmq" })'" />
</div>
<div id="msmqpartial">
@{Html.RenderPartial("Partial1", Model); }
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
和部分:
@using System.Web.Mvc.Html
@model MsmqTestApp.Models.MsmqData
<p>
Items to buy
@foreach (var item in Model.ItemsToBuy)
{
<tr>
<td>@Html.DisplayFor(model => item)
</td>
</tr>
}
</p>
<p>
<a>Items …
Run Code Online (Sandbox Code Playgroud) 如果我安装Gallio 3.x还会为Visual Studio安装一个测试运行器插件吗?
或者我是否必须使用其他插件(如TestDriven.NET或Visual Nunit)从VS中运行MbUnit测试类?
我有那个代码加密字符串到sha256和base64旁边:
public static string Sha256encrypt(string phrase)
{
UTF8Encoding encoder = new UTF8Encoding();
SHA256Managed sha256hasher = new SHA256Managed();
byte[] hashedDataBytes = sha256hasher.ComputeHash(encoder.GetBytes(phrase));
return Convert.ToBase64String(hashedDataBytes);
}
Run Code Online (Sandbox Code Playgroud)
如何在另一方解密我的密码?
我有angularJs控制器
angular.module('App.ctrl.guests', [])
.controller('guestsController', ['$scope', '$http', '$location', '$timeout', 'guestsService', function ($scope, $http, $location, $timeout, guestsService) {
$scope.tiles = [];
}])
Run Code Online (Sandbox Code Playgroud)
和茉莉花测试
/// <reference path="~/Scripts/angular.js" />
/// <reference path="../../ProjectWeb/Scripts/app/guests/guestsCtrl.js" />
/// <reference path="~/Scripts/angular-mocks.js" />
/// <reference path="~/Scripts/jasmine.js" />
'use strict';
describe('App.ctrl.guests', function () {
var scope, controller;
beforeEach(function () {
module('App.ctrl.guests')
});
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
controller = $controller('guestsController', {
$scope: scope
});
}));
it('should have empty array', function () {
expect(scope.tiles).toBe([]);
});
})
Run Code Online (Sandbox Code Playgroud)
每次我在Visual studio chutzpah运行时,我得到:
ReferenceError:找不到变量:file …
c# ×5
.net ×1
angularjs ×1
asp.net ×1
asp.net-mvc ×1
chutzpah ×1
cryptography ×1
encryption ×1
enums ×1
gallio ×1
jasmine ×1
javascript ×1
linq ×1
list ×1
mbunit ×1
msbuild ×1
plugins ×1
reflection ×1
t-sql ×1