如果我调用WCF服务方法,我会做这样的事情:
proxy.DoSomethingAsync();
proxy.DoSomethingAsyncCompleted += OnDoSomethingAsyncCompleted;
Run Code Online (Sandbox Code Playgroud)
我怎么能用新的async
ctp 做同样的事情?我想我会需要这样的东西proxy.DoSomethingTaskAsync
还是proxy.DoSomethingAsync().ToTask()
?Web服务调用需要返回一个Task<T>
能够使用await
关键字,但如何?
这是我的配置:
我们正在开发一个OSGi应用程序,并希望包含日志记录.我决定使用slf4j + logback.
我们使用Eclipse作为IDE和Tycho从Eclipse IDE(如Manifest Editor等)中受益.
所以我尝试了以下方法:
使用以下Manifest.mf创建了一个新插件:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Createcommand
Bundle-SymbolicName: de.hswt.oms.ws.wsr.createcommand
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: de.hswt.oms.ws.command.wsr,
de.hswt.oms.ws.ds.core.data.impl,
org.slf4j
Service-Component: OSGI-INF/component.xml
Run Code Online (Sandbox Code Playgroud)
现在,当我转到Run - > Run Configurations - > OSGi Framework并选择我的Bundle并单击"Add Required plugins"时,将选择100多个Bundles,我会收到很多错误和异常.
所以我想出了一个来自现有Jars的新插件,其中包括以下三个罐子:
如果我手动创建一个新的运行配置(不点击"添加必需的捆绑",它按预期工作,但只要我点击"添加必需的捆绑"我回到100多个捆绑包有很多错误(一些Jetty的东西为例...)
所以我的问题是:如何在我的OSGi应用程序中启用logback和slf4j并在eclipse中使用它并正确配置它?
如果您需要更多信息,请随时询问.
我正在尝试在Equinox项目中使用Apache Sling日志记录.它工作正常,但我不能让Sling使用我的配置文件.我正在使用标准的logback配置xml,它应该根据Sling文档工作.但无论我在哪里放置配置文件Sling只是不使用它.
我的logback配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} *%level* [%thread] %logger %message%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Run Code Online (Sandbox Code Playgroud) 如何处理以下问题?
我们正在使用延迟加载的NHibernate属性,每当我们调用Equals()
或使用GetHashCode()
任何属性时,都会延迟加载,可能导致一连串的延迟加载操作.可以使用急切加载作为替代方案,但我认为仅在特定情况下而不是作为一般解决方案.
典型情况如下:
public class AbstractSaveableObject {
[Id(0, Name = "Id", UnsavedValue = null)]
[Generator(1, Class = "native")]
public virtual long? Id { get; set; }
}
[Class(NameType = typeof(ClassA))]
public class ClassA : AbstractSavableObject {
[Bag(0, Inverse = true, Cascade = "none")]
[Key(1, Column = "ClassA")]
[OneToMany(2, ClassType = typeof(ClassB))]
public virtual ICollection<ClassB> ClassBs { get; set; }
}
[Class(NameType = typeof(ClassB))]
public class ClassB : AbstractSavableObject {
[ManyToOne(Column = "ClassA")]
public virtual …
Run Code Online (Sandbox Code Playgroud) 是否有一种方便的方法来初始化Set
等价于Collections.singleton
,它返回一个可变的Set
而不是一个不可变的?
我正在尝试wsHttpBinding
向soapUI 添加WCF服务.
我正在使用消息安全性,它适用于测试客户端,但SoapUI返回
验证邮件的安全性时发生错误
这是服务配置:
<wsHttpBinding>
<binding name="wsHttpSecure">
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="true"
establishSecurityContext="false" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
这里http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html是一份文件,但他们说我需要.jks文件.我只在测试客户端配置文件中编码了SvcUtil生成的公钥值.
我想查询一个nhibernate映射类,但结果应该是一个未映射的对象.映射和未映射的类如下所示:
[Class(NameType = typeof(ClassA)]
public class ClassA
{
[Cache(0, Usage = CacheUsage.ReadWrite)]
[Id(1, Name = "Id", UnsavedValue = null)]
[Generator(2, Class = "native")]
public virtual long? Id { get; set; }
[Property]
public virtual string PropertyA { get; set; }
[Property]
public virtual string PropertyB { get; set; }
}
public class ClassB
{
public string PropertyA { get; set; }
public string PropertyB { get; set; }
public int Number { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我用这个方法得到我想要的结果:
public ICollection<ClassB> Group() …
Run Code Online (Sandbox Code Playgroud) 可能重复:
SQL Server 2005仅还原一个架构
我有一个包含几个SQL Server 2008 R2中的架构的数据库。所有模式都包含相同的表。现在,我希望能够仅还原一个模式的备份,而其他模式保持原样。
我正在寻找等同于pg_restore --schema="schemaname"
在PostgreSQL中使用的东西。有什么办法可以在SQL Server中做到这一点?
database sql-server database-backups sql-server-2008-r2 database-schema
attribute_group_attribute.default_value
我在 PostgreSQL 9.3 中定义了一个触发器,它根据 的值检查 的长度attribute_type.max_length
:
CREATE OR REPLACE FUNCTION trigger_function()
RETURNS trigger AS
$BODY$
DECLARE
is_longer_than_max_length BOOLEAN;
BEGIN
IF (NEW.default_value IS NOT NULL) THEN
SELECT length(NEW.default_value) > attribute_type.max_length
INTO is_longer_than_max_length FROM attribute_group_attribute
JOIN attribute ON NEW.attribute_id = attribute.id JOIN attribute_type
ON attribute.attribute_type_id = attribute_type.id;
IF (is_longer_than_max_length) THEN
RAISE EXCEPTION 'Attribute type with id % has max length of %,
while attribute default value % has a length of %.',
attribute_type.id, attribute_type.max_length, NEW.default_value,
length(NEW.default_value) USING ERRCODE='20808';
END …
Run Code Online (Sandbox Code Playgroud) c# ×3
equinox ×2
java ×2
nhibernate ×2
osgi ×2
async-await ×1
asynchronous ×1
database ×1
eclipse ×1
lazy-loading ×1
logback ×1
plpgsql ×1
postgresql ×1
slf4j ×1
sling ×1
soapui ×1
sql-server ×1
triggers ×1
tycho ×1
wcf ×1