假设有一个带有构造函数的抽象类,该构造函数调用一个尚未由子类实现的受保护抽象方法.这是一个好主意还是坏主意?为什么?
我们正在尝试将一些动态可配置的日志记录实现到我们的Azure应用程序中,并且我们正在使用企业库来完成这项工作,但是为了实现这一点而需要的xml比ServiceConfiguration的简单"appSetting"样式设置更复杂. .cscfg文件似乎接受,因为它需要嵌套的xml节点,
例如
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
Run Code Online (Sandbox Code Playgroud)
解决了(请原谅这个窗口中的格式):
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="OurSolution.Common.AzureDiagnosticTraceListener, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name="AzureDiagnosticTraceListener" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="AzureDiagnosticTraceListener" />
</listeners>
</add>
</categorySources>
</loggingConfiguration>
Run Code Online (Sandbox Code Playgroud)
我看不到愚弄ServiceDefinition或ServiceConfiguration文件来接受这个的方法,尽管我可以看到一种方法告诉企业库使用我可以在app.config中执行的ServiceConfiguration文件.
为什么我们试图解决这个问题是为了允许我们动态调整日志记录的设置,即从No logging更改为Verbose而不必进行重新部署,这在我们的实时应用程序中证明是耗时且不切实际的住,所以可能还有奇怪的虫子;-) …
每当我尝试创建一个特定的实体时获得这个......只是想知道我应该如何找出原因.
我正在使用Fluent NHibernate自动化,所以也许我没有适当地设置约定和/或需要覆盖一个或多个映射文件中的某些东西.我已经通过网络上关于这个问题的一些帖子,并且很难弄清楚为什么它会发生在我的案例中.
我正在保存的对象非常简单.它是一个引用"公司"实体并具有"地址"实体集合的"人"对象.UPDATES在已存在于数据库中的现有Person对象上正常工作.
建议?
谢谢-wg
我想将字符串"15,678"转换为值15678.方法parseInt()
并且parseFloat()
都返回15为"15,678".是否有捷径可寻?
[Python 3.1]
我在python的输出中遇到负零; 它的创建举例如下:
k = 0.0
print(-k)
Run Code Online (Sandbox Code Playgroud)
输出将是-0.0
.
但是,当我将-k
0.0 比较为相等时,它会产生True.有什么区别0.0
和-0.0
(我不在乎他们可能有不同的内部表示.我只关心自己的程序中的行为)是否有任何隐藏的陷阱我应该知道的?
我希望有人可以帮助我.
我正在尝试在我的网站主页上实现一个"在线用户数"计数器.我记得在ASP过去的糟糕时期,我曾经能够通过session.onstart和session.onend保持计数器.
我如何在Django中做到这一点?
干杯
丰富
如何将表从SQL Server 2000数据库导出到.sql文件作为一堆INSERT INTO语句?
表中的一个字段是Text数据类型并保存HTML,因此手动执行此操作将非常耗时.
我可以访问SQL Server Management Studio 2008来访问SQL Server 2000数据库.
我想设计一个数据库,描述如下:每个产品在一个时间点只有一个状态.但是,产品的状态可能会在其生命周期内发生变化.我如何设计产品和状态之间的关系,可以很容易地查询当前特定状态的所有产品?另外,有谁可以请给我一些关于设计数据库的深入细节,这些数据库与上述问题的持续时间有关?谢谢你的帮助
如何删除TextBox
Control 的默认上下文菜单?
是否有禁用它的属性?
谢谢 :)
我正在编写一个小型的C++程序,它将一个二维数组(复数)传递给一个Fortran子程序,然后将它接收回来填充值.我写了一个通过并接收一维数组的版本,这很有效.2-D版本不起作用(我的真正目标是编写具有大尺寸的4-D版本 - 因此必须动态分配这些数组).
我将发布我的工作代码和非工作代码,但首先请注意我被迫使用结构(简单的,只包含两个双精度),因为Fortran似乎以与其自身的原始复数完全相同的方式解释它们.这就是我的1-D版本有效的原因.出于同样的原因,我不认为这是一个"复杂数字"的问题.
这是我的工作代码.将一维复数数组传递给Fortran子程序:
Fortran子程序:
subroutine carray(A)
complex*16 A(2)
A(1) = cmplx(3,7)
A(2) = cmplx(9,5)
return
end
Run Code Online (Sandbox Code Playgroud)
C++代码:
include <iostream>
include <complex>
using namespace std;
struct cpx{double r, i;};
extern"C"
{
void carray_(struct cpx* A);
}
int main()
{
struct cpx* A;
A = new struct cpx [2];
carray_(A);
complex<double>* P;
P = new complex<double> [2];
for(x = 0; x < 2; x++)
{
real(P[x] = A[x].r;
imag(P[x] = A[x].i;
}
cout << real(P[0]) << "\t" << imag(P[0]) << …
Run Code Online (Sandbox Code Playgroud) sql-server ×2
.net ×1
architecture ×1
automapping ×1
azure ×1
c# ×1
c++ ×1
data-export ×1
database ×1
django ×1
fortran ×1
javascript ×1
jquery ×1
logging ×1
mysql ×1
nhibernate ×1
oop ×1
python ×1
sql ×1
t-sql ×1
winforms ×1
zero ×1