我有一个十进制值("133,3")存储在挪威文化中的数据库的字符串列中.
之后,用户将区域设置更改为english-Us.当我使用CultureInfo.InvariantCulture将"133,3"转换为十进制时,获取无效值或错误.
有没有最好的方法来处理C#应用程序中的这种情况?
问候,阿南德
当我执行删除存储过程时,我收到“ORA-01013:用户请求取消当前操作”。
并且从应用程序抛出异常也需要时间(大约超过 10 秒)
当我在 Toad 中执行此查询时需要 30 多秒,当我取消它时,在输出窗口中,它显示上述错误。
我认为,dataaccess 博客在超时时会自动取消。
我想知道为什么需要 30 秒。当我单独运行选择查询时,没有记录。
当我只调用 delete 时,它需要时间。
DELETE FROM ( SELECT *
FROM VoyageVesselBunkers a
JOIN VoyageVessel b
ON a.VoyageVesselId = b.Id
WHERE a.Id = NVL(null,a.Id)
AND b.VoyageId = NVL('5dd6a8fbb69d4969b27d01e6c6245094',b.VoyageId)
AND a.VoyageVesselId = NVL(null,a.VoyageVesselId) );
Run Code Online (Sandbox Code Playgroud)
任何建议。阿南德
我有大约 20 个 dll,导出、导入部分。每个dll中有一个类,具有导入和导出属性。但是在编写 MEF 时,它会扫描 dll 中所有可用的类型。
下面的结果仅取自一个 dll 的输出。
因此,compose 方法需要时间。如何避免不必要的类型扫描?
sample plugin
[ModuleAttibute("MENU")]
[ExportMetadata("SAMPLE", "SAMPLE")]
public class MenuModule : IModule
{
}
public static bool CheckParts(ComposablePartDefinition partDef)
{
var keepPart = (from e in partDef.ExportDefinitions
where e.Metadata.ContainsKey("Sample")
select e).Any();
return keepPart;
}
public class FilteredCatalog : ComposablePartCatalog
{
private readonly ComposablePartCatalog _inner;
private readonly Func<ComposablePartDefinition,bool> _partsQuery;
public FilteredCatalog(ComposablePartCatalog inner, Func<ComposablePartDefinition, bool> expression)
{
_inner = inner;
_partsQuery = expression;
}
public override IQueryable<ComposablePartDefinition> Parts
{
get
{ …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Windows应用程序,我需要在网格中显示对象及其子项列表.因此用户可以修改从实体框架中检索的实体.
在更新db中的对象时,看起来需要从db检索对象并分配新值.这可能会导致性能问题.有没有解决这个问题?
public class Vehicle
{
public Vehicle()
{
this.Fillups = new List<FillupEntry>();
this.Reminders = new List<Reminder>();
}
public int VehicleId { get; set; }
public int UserId { get; set; }
public string Name { get; set; }
public string ModelName { get; set; }
public ICollection<FillupEntry> Fillups { get; set; }
public ICollection<Reminder> Reminders { get; set; }
}
public void Update(Vehicle updatedVehicle)
{
Vehicle vehicleToUpdate =
this.GetDbSet<Vehicle>()
.Where(v => v.VehicleId == updatedVehicle.VehicleId)
.First();
vehicleToUpdate.Name = …Run Code Online (Sandbox Code Playgroud) 当我通过WCF从ASP.NET MVC检索所有订单及其OrderDetails时,它会抛出错误.直到服务它工作正常,只有当调用在这种情况下停止服务MVC时,它才会抛出错误:
底层连接已关闭:连接意外关闭.
我没有使用延迟加载
我想使用相同的POCO类,不希望在WCF中单独创建DataContract.
我的代码:
public class HomeController : Controller
{
public ActionResult Index()
{
ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
var allOrders = service.GetAllOrders();
service.Abort();
return View();
}
}
// WCF Service Method
public List<Order> GetAllOrders()
{
List<Order> orders = null;
using (NorthwindEntities context = new NorthwindEntities())
{
orders = context.Set<Order>().Include("Order_Details").AsEnumerable().ToList();
}
return orders;
}
public class Order
{
public Order()
{
this.Order_Details = new HashSet<Order_Detail>();
}
public virtual ICollection<Order_Detail> Order_Details { get; set; }
}
public class Order_Detail …Run Code Online (Sandbox Code Playgroud) c# wcf exception-handling entity-framework-4.1 asp.net-mvc-3