C# Lambda 转换为 VB
您好,我一直在查看有关 Sharparchitecture 的某些教程,但没有成功(在线转换器似乎无法做到这一点):
private Action<AutoMappingExpressions> GetSetup()
{
return c =>
{
c.FindIdentity = type => type.Name == "Id";
};
}
private Action<IConventionFinder> GetConventions()
{
return c =>
{
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ForeignKeyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.HasManyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.HasManyToManyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ManyToManyTableNameConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.PrimaryKeyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ReferenceConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.TableNameConvention>();
};
}
Hi I have been looking at certain tutorials on sharparchitecture and trying to no avail (the online convertors don't seem to be able to do this):
private Action<AutoMappingExpressions> GetSetup()
{
return c =>
{
c.FindIdentity = type => type.Name == "Id";
};
}
private Action<IConventionFinder> GetConventions()
{
return c =>
{
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ForeignKeyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.HasManyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.HasManyToManyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ManyToManyTableNameConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.PrimaryKeyConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.ReferenceConvention>();
c.Add<MVCTemp.Data.NHibernateMaps.Conventions.TableNameConvention>();
};
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您正在尝试将其转换为 VB.Net。
在 Visual Basic 2010 之前(当前为 测试版),这是不可能的。
VB.Net 2008 中的 Lambda 表达式只能保存单个表达式。
但是,您可以创建完成工作并返回它们的
共享
辅助函数。例如:(在VB中)
I assume that you're trying to convert this to VB.Net.
Until Visual Basic 2010 (currently in beta), it's not possible.
Lambda expressions in VB.Net 2008 can only hold a single expression.
However, you could create
Shared
helper functions that do the work and return them.For example: (In VB)