假设我有一个像这样的.NET类:
public class Person {
public string Name { get; set; }
public int Id { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
Visual Studio有一个名为Extract Interface的漂亮的重构工具,它将提取一个IPerson接口并Person实现它.有没有办法从Visual Studio外部以编程方式执行此操作?如果不能以编程方式完成,我甚至会使用shell脚本.
[编辑]实际上,我最多有50个类,每个类都有相互依赖.
反思会起作用,但它会在整个事物中引入另一个皱纹.这些类已经由生成xsd.exe.所以,如果我理解正确,我需要采取的步骤是:
xsd.exe.一般来说,我赞成放弃接口并直接使用类,但出于各种原因我不能.
我在Windows Server 2003上运行Apache/SVN,通过LDAP/Active Directory和平面文件进行身份验证.
除了任何 LDAP用户都可以访问所有内容之外,它工作得很好.我希望能够按用户或组限制SVN存储库.
理想情况下,我会得到这样的东西:
<Location /svn/repo1>
# Restricted to ldap-user1, file-user1, or members of ldap-group1,
# all others denied
</Location>
<Location /svn/repo2>
# Restricted to ldap-user2, file-user2, or members of ldap-group2,
# all others denied
</Location>
Run Code Online (Sandbox Code Playgroud)
真正的诀窍可能是我有混合身份验证:LDAP和文件:
<Location /svn>
DAV svn
SVNParentPath C:/svn_repository
AuthName "Subversion Repository"
AuthType Basic
AuthBasicProvider ldap file
AuthUserFile "svn-users.txt" #file-based, custom users
AuthzLDAPAuthoritative On
AuthLDAPBindDN ldapuseraccount@directory.com
AuthLDAPBindPassword ldappassword
AuthLDAPURL ldap://directory.com:389/cn=Users,dc=directory,dc=com?sAMAccountName?sub?(objectCategory=person)
Require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)
在我的谷歌搜索中,我看到有些人通过authz像这样拉入文件来实现这一点:
<Location /svn>
...
AuthzSVNAccessFile "conf/svn-authz.txt"
</Location …Run Code Online (Sandbox Code Playgroud) 我正在尝试在网站上创建“将网页另存为位图”功能,但在服务器端以正确的大小呈现文本时遇到了一些问题。
客户端文本的字体大小设置为:
.textDiv
{
font-family: Verdana;
font-size:16px;
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试在服务器上呈现它
float emSize = 16;
g.DrawString("mytext", new Font("Verdana", emSize), Brushes.Black, x, y);
Run Code Online (Sandbox Code Playgroud)
文本将在服务器上变大约 20%。
new Font()的文档说第二个参数(字体大小)应该在 em-points 中指定。一个em-point究竟是什么?
如果我在浏览器中指定 font-size:16em,文本会变得很大。如果我在浏览器中指定 font-size:1em 文本将大约 14px 大,但如果我把 1 作为服务器上的参数,文本变成一条细线。
那么,我如何从浏览器 px 或 em 转换为 .net px/em。
我曾经看到,在MS突破某些事情之前,.net社区已经意识到了这一点.我在这里谈论ALT NET和开源人员,他们就像"如果MS提出实体框架,我们有NHibernate".我只是想知道一个MVC框架是否值得关注哪个不是由MS构建的.
有没有?微软是第一个想出类似东西的时刻吗?
有人可以帮忙吗?
当您开始将异步调用与Parallelization混合以获得最佳性能时,更新事情会变得复杂得多.这是在几个下载器上实现的,比如Firefox下载器,它同时获得2次下载,当其中一个完成时,它会获得下一个文件,依此类推.也许它似乎很容易实现,但是当我实现它时,我已经并且仍然有麻烦使它成为通用的(对WebRequest和DbCommand有用)并处理问题(即超时)
赏金猎人赏金将被授予第一个链接可靠和免费($$).NET库的赏金,它提供了一种简单的C#方式来并行化异步任务,如HttpWebRequests.BegingetResponse和SqlCommand.BeginExecuteNonQuery.并行化不能等待N个任务完成然后启动下一个N,但是一旦N个初始任务中的一个完成,它必须立即开始新任务.该方法必须提供超时处理.
存储过程中支持和反对业务逻辑的参数是什么?
所以这里是交易.我想调用一个类并将值传递给它,以便它可以在所有各种函数中的类中使用.等.我该怎么做呢?
谢谢,山姆
使用C#3.0,我知道你可以使用'this'命名扩展方法.
我正在尝试扩展Math.Cos(双弧度)以包含我的新类.我知道我可以在现有的课程中创建一个"Cos"方法,但我只是想看看如何/为了练习这样做.
在尝试了一些新的东西之后,我回到了SO以获得输入.我被卡住了.
这就是我现在所拥有的......
public class EngMath
{
/// ---------------------------------------------------------------------------
/// Extend the Math Library to include EngVar objects.
/// ---------------------------------------------------------------------------
public static EngVar Abs(this Math m, EngVar A)
{
EngVar C = A.Clone();
C.CoreValue = Math.Abs(C.CoreValue);
return C;
}
public static EngVar Cos(this Math m, EngVar A)
{
EngVar C = A.Clone();
double Conversion = 1;
// just modify the value. Don't modify the exponents at all
// is A degrees? If so, convert to radians.
if (A.isDegrees) Conversion …Run Code Online (Sandbox Code Playgroud) 我发现了一个令人讨厌的VBS方法,但我正在寻找一个原生的PoSh程序来编辑.LNK文件的属性.目标是联系远程计算机,复制具有大多数正确属性的现有快捷方式,并编辑其中的几个.
如果编写新的快捷方式文件会更容易,那也可以.
考虑以下代码:
public IEnumerable <Country> ListPopulation()
{
foreach(var continent in Continents)
{
var ids = context.continentTable
.where(y=>y.Name == continent.name)
.select(x=>x.countryId);
}
return GetPopulation(ids);// ids is not available here
}
Public IEnumerable<Country>GetPopulation(IQueryable<int> idnumbers)
{
}
Run Code Online (Sandbox Code Playgroud)
如何初始化var ids我可以使用它来调用GetPopulation()?
.net ×3
c# ×3
alt.net ×1
apache2 ×1
class ×1
connection ×1
css ×1
file ×1
font-size ×1
ldap ×1
linq ×1
open-source ×1
php ×1
powershell ×1
refactoring ×1
shortcuts ×1
svn ×1
var ×1
variables ×1
winforms ×1