这个看起来应该非常简单,但我无法弄明白或找到任何东西.我的查询看起来像这样:
from o in objects
select new
{
o.ID,
o.member.Number,
o.member.Date,
o.member.total,
o.SequenceNumber,
o.InputDate,
o.Amount,
o.Discount,
Balance = o.Balance(),
o.otherMember.CreatedBy,
}
Run Code Online (Sandbox Code Playgroud)
请注意,有很多次我访问o.member.在现实生活中,这就像20次(我正在聚合网格的数据集).我想做的是能够像这样引用它:
select new
{
o.ID,
m.Number,
m.Date,
m.total,
o.SequenceNumber,
o.InputDate,
o.Amount,
o.Discount,
Balance = o.Balance(),
o.otherMember.CreatedBy,
}
Run Code Online (Sandbox Code Playgroud)
但我不确定使用正确的语法.是否有可能在顶部别名,或以某种方式加入?
当我尝试设置模拟时,我收到此错误PropertyBehavior():
System.InvalidOperationException:System.InvalidOperationException:无效调用,最后一次调用已被使用或未进行任何调用(请确保您正在调用虚拟(C#)/ Overridable(VB)方法).
我试图只使用Rhino Mocks 3.5(安排,行动,断言)
这是我的代码:
private IAddAddressForm form;
private AddAddressMediator mediator;
[TestInitialize()]
public void MyTestInitialize()
{
form = MockRepository.GenerateMock<IAddAddressForm>();
mediator = new AddAddressMediator(form);
// Make the properties work like a normal property
Expect.Call(form.OKButtonEnabled).PropertyBehavior();
//I tried this too. I still get the exception
//SetupResult.For(form.OKButtonEnabled).PropertyBehavior();
}
[TestMethod]
public void TestOKButtonEnabled()
{
form.OKButtonEnabled = true;
Assert.IsTrue(form.OKButtonEnabled);
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用存根(对于我应该使用的代码),但我正在尝试学习Rhino Mocks.
最终,我希望能够确保访问多个属性的值.(关于如何检查form.FirstName访问的任何提示(即调用getter)也将不胜感激.)
如果需要,以下代码IAddressForm:
namespace AddressBook
{
public interface IAddAddressForm
{
string FirstName { get; set; …Run Code Online (Sandbox Code Playgroud) c# rhino-mocks visual-studio-2008 visual-studio rhino-mocks-3.5
mod_rewrite当函数apache_get_modules()不可用时,是否可以在PHP中检测?
我正在使用ComboBox控件,无法从我的viewmodel上的属性中设置SelectedItem.这是控件定义:
<ComboBox x:Name="jobEmployee" Grid.Column="1" Grid.Row="2"
Margin="4" HorizontalAlignment="Left" Width="150"
SelectedItem="{Binding Path=EditingJob.Employee, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}"
ItemsSource="{Binding Path=Employees, Mode=OneWay}"
DisplayMemberPath="FullName"/>
Run Code Online (Sandbox Code Playgroud)
我有另一个Combobox控件,工作得很好.设置SelectedItem的设备与不设置SelectedItem的设备之间的差异是属性定义的顺序.这是工作控件定义:
<ComboBox x:Name="jobEmployee" Grid.Column="1" Grid.Row="2"
Margin="4" HorizontalAlignment="Left" Width="150"
ItemsSource="{Binding Path=Employees, Mode=OneWay}"
SelectedItem="{Binding Path=EditingJob.Employee, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}"
DisplayMemberPath="FullName"/>
Run Code Online (Sandbox Code Playgroud)
2之间的区别在于ItemsSource是在工作的SelectedItem之前定义的,这使我相信至少在这种情况下,属性定义顺序很重要.我错过了什么或让别人发现这是真的吗?有没有记录在任何地方?
使用Visual Studio 2005 - C#2.0,System.Net.WebClient.UploadData(Uri address, byte[] data) Windows Server 2003
所以这是代码的精简版本:
static string SO_method(String fullRequestString)
{
string theUriStringToUse = @"https://10.10.10.10:443"; // populated with real endpoint IP:port
string proxyAddressAndPort = @"http://10.10.10.10:80/"; // populated with a real proxy IP:port
Byte[] utf8EncodedResponse; // for the return data in utf8
string responseString; // for the return data in utf16
WebClient myWebClient = new WebClient(); // instantiate a web client
WebProxy proxyObject = new WebProxy(proxyAddressAndPort, true);// instantiate & popuylate a web proxy
myWebClient.Proxy …Run Code Online (Sandbox Code Playgroud) 什么是.NET中的Java小程序?是Silverlight吗?Java applet还在广泛使用吗?
我在编译.pas文件时遇到错误.
"不满意的前向或外部声明:TxxxException.CheckSchemeFinMethodDAException."
有谁知道这个错误意味着什么?
这是否意味着
CheckSchemeFinMethodDAException没有在所有相关文件中调用?
过去几天我一直试图测试我的第一个应用程序中的purchse iphone应用程序.不幸的是我无法找到与iTunes服务器通信以验证transactionReceipt的方法.
因为这是我第一次尝试使用这项技术,所以我选择直接从iPhone验证收据,而不是使用服务器支持.但是在尝试使用来自谷歌代码的JSON api创建的JSON onbject发送POST请求之后,itunes总是返回一个奇怪的响应(而不是我等待的"status = 0"字符串).
这是我用来验证收据的代码:
- (void)recordTransaction:(SKPaymentTransaction *)transaction {
NSString *receiptStr = [[NSString alloc] initWithData:transaction.transactionReceipt encoding:NSUTF8StringEncoding];
NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"algo mas",@"receipt-data",nil];
NSString *jsonString = [jsonDictionary JSONRepresentation];
NSLog(@"string to send: %@",jsonString);
NSLog(@"JSON Created");
urlData = [[NSMutableData data] retain];
//NSURL *sandboxStoreURL = [[NSURL alloc] initWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"will create connection");
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}
Run Code Online (Sandbox Code Playgroud)
也许我忘记了请求标题中的内容,但我认为问题出在我用来创建JSON对象的方法中.
在将JSON对象添加到HTTPBody之前,它是如何看起来的:
string to send: {"receipt-data":"{\n\t\"signature\" = \"AUYMbhY
...........
D0gIjEuMCI7Cn0=\";\n\t\"pod\" = \"100\";\n\t\"signing-status\" = \"0\";\n}"} …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Python中创建一个简单的脚本,它接受一个数字并保存在一个变量中,按升序和降序对数字进行排序,并将两者保存在单独的变量中.实施Kaprekar的常数.
这可能是一个非常愚蠢的问题.但我是新手,我在Google上找不到任何可以帮助我的东西.我找到的一个网站试图解释使用列表的方式,但它没有很好地解决.
我知道这是主观的,但我想知道人们的意见,并希望在设计sql server表结构时能够应用一些最佳实践.
我个人认为在固定(最大)长度varchar上键入一个表是禁止的,因为它意味着必须在使用它作为外键的任何其他表中传播相同的固定长度.使用a int,将避免必须在整个板上应用相同的长度,这必然导致人为错误,即1个表具有varchar (10),而另一个表varchar (20).
这听起来像是最初设置的噩梦,而且意味着将来维护表格也很麻烦.例如,假设keyed varchar列突然变成12个字符而不是10个字符.你现在必须去更新所有其他表,这可能是一个巨大的任务多年.
我错了吗?我错过了什么吗?我想知道其他人对此的看法,以及坚持使用int作为主键是避免维护噩梦的最佳方法.
c# ×2
.net ×1
apache ×1
applet ×1
c#-2.0 ×1
delphi ×1
java ×1
json ×1
linq ×1
mod-rewrite ×1
numbers ×1
objective-c ×1
php ×1
python ×1
rhino-mocks ×1
sql ×1
sql-server ×1
storekit ×1