|
I'm trying to combine a few components of the Enterprise Library. In this instance, I want to implement some retry logic (Transient Fault Handling) but I want to add this in behind-the-scenes (via Unity Interception). I'm using interception elsewhere but I can't seem to figure out the syntax needed to add these two components together. For interception, this will essentially be a no-op, but is where I can add my retry logic, within an IInterceptionBehavior: code:
code:
code:
tl;dr I know how to use Transient Fault Handling and Unity Interception, but don't know how to combine them together
|
# ¿ Jul 15, 2014 14:41 |
|
|
# ¿ May 4, 2024 17:36 |
|
kingcrimbud posted:I'm trying to combine a few components of the Enterprise Library. In this instance, I want to implement some retry logic (Transient Fault Handling) but I want to add this in behind-the-scenes (via Unity Interception). I'm using interception elsewhere but I can't seem to figure out the syntax needed to add these two components together. Bueller? Anyone? I still haven't figured this out.
|
# ¿ Jul 17, 2014 01:04 |
|
Sedro posted:A beautiful example These lines are a lot simpler than I thought they would be: code:
|
# ¿ Jul 18, 2014 14:24 |
|
I'm in the middle of creating a service that consumes something like 100 other services. My service will have its own model. Let's say my model has a Pet entity. And 15 of these other services have their own representations of what a pet is. If I search these other systems and then try to represent these pets in my system, how can I model that correctly when each system has their own representation of a pet? We've explored inheritance and creating a type per system. This gets really ugly fast and will be awful to maintain. We've also explored decorating and compositing but again, this gets really complicated very quickly. In some cases, a Pet entity may have to have 20 new properties tacked on. I'm currently looking at using the DynamicObject class and having my Pet inherit from it. I'm losing out on some safety and probably performance, but I can just set whatever properties I want on my Pet whenever I want. Anyone experience a situation like this and come up with a good answer?
|
# ¿ Aug 8, 2014 19:52 |
|
Dirk Pitt posted:Ahhh, I was using task.run to avoid having to make an async void. Task is the return type for async methods that would otherwise return void. C# code:
|
# ¿ Oct 21, 2014 06:49 |
|
Ithaqua posted:If you're dealing with a void method that you're overriding, you can't go and change the method signature to Task. That's the problem. You also can't have an async constructor, for obvious reasons. You're right, I looked over the changing of the signature part.
|
# ¿ Oct 21, 2014 14:27 |
|
What is the proper approach to using FileConfigurationSource with a relative path to a config in another project? The value that works locally does not work once deployed. I believe the config has been set to copy if newer. We've also tried adding the config as a link in the project creating the FileConfigurationSource.
|
# ¿ Oct 23, 2014 02:41 |
|
GrumpyDoctor posted:Here I am patiently waiting for a connection to my HttpListener: You're not running this in a console project are you? I've forgotten to Console.Readkey or whatever before when awaiting in a quick POC project and seen similar results.
|
# ¿ Nov 4, 2014 02:26 |
|
RICHUNCLEPENNYBAGS posted:Unit testing can be really handy but I don't believe in TDD. Also, I think it's a little bit like a church in that even its adherents don't actually always do it, but they all find guilty about it and try to make other people feel guilty too. Unit tests don't necessarily show that software is 'correct'. They simply allow you to show it does something, so that when you make changes to your software you can quickly see how that something changed. The better your testing, the more accurate you can measure the potential delta.
|
# ¿ Dec 17, 2014 03:47 |
|
RICHUNCLEPENNYBAGS posted:So we are in agreement. Yes and no. I personally think TDD makes sense on paper. With what I said before, unit tests can guarantee a minimum state of the classes in your system. Once a class changes, tests can go red or they can stay green. If you've truly designed your system well (good luck doing that) where you're open for extension and closed for modification, then your tests from TDD will already cover your previous code and you'll never go red. Two problems with this though is that we'll never design it perfectly the first time and requirements will always shift. Until we get perfect requirements with which we can perfectly design, TDD will not be perfect.
|
# ¿ Dec 19, 2014 07:49 |
|
RICHUNCLEPENNYBAGS posted:Yeah, that's pretty much the same as EF. There's no second guessing what the url of an action is when they're on top of each other.
|
# ¿ Jan 16, 2015 06:35 |
|
Enterprise Library Semantic Logging question here. We're logging out of process to a few rolling files and it works great except for one small thing. The logs aren't written to the file unless the service is stopped/restarted or the file rolls over. This doesn't allow us to read into the files at 'real-time' and it's a pain. This is not standard behavior apparently and is happening locally and on the server. I don't think too many people use SLAB but maybe someone has an idea?
|
# ¿ Jan 30, 2015 03:33 |
|
Boz0r posted:Now I've got another problem. I'm trying to get this Entity Framework to work with my database. Right now, I've added a couple of objects via code, but when I want to retrieve them, I just get an empty collection. Your Index() method is not enumerating over your locally declared areas variable and because you're not returning this variable by this method, your database won't even be hit with a select statement. Add this to your config to see what's actually happening in your database because of EF: http://blog.oneunicorn.com/2014/02/09/ef-6-1-turning-on-logging-without-recompiling/
|
# ¿ Jun 22, 2015 14:12 |
|
Relating to the Entity Framework talk above, what are people using with Web API and Unity when they need PerRequestLifetimeManager behavior? I don't want to pull in all these MVC packages to use one class (PerRequestLifetimeManager) to manage my DbContexts. And frankly, registering this lifetime manager doesn't seem to be currently working anyway for me even when I register it. I'm still seeing singleton behavior.
|
# ¿ Jun 22, 2015 14:18 |
|
kingcrimbud posted:Relating to the Entity Framework talk above, what are people using with Web API and Unity when they need PerRequestLifetimeManager behavior? I don't want to pull in all these MVC packages to use one class (PerRequestLifetimeManager) to manage my DbContexts. And frankly, registering this lifetime manager doesn't seem to be currently working anyway for me even when I register it. I'm still seeing singleton behavior. I figured this out after creating a new solution. Be careful how you register DelegatingHandlers! Their singleton behavior means dependencies will not resolve per your expectations.
|
# ¿ Jun 23, 2015 02:53 |
|
Night Shade posted:If you want per request scoping to work right in a DelegatingHandler, you need to call request.GetDependencyScope() in SendAsync and use the resulting IDependencyScope as a service locator. I ended up following this http://stackoverflow.com/a/26472999 and using an IUnityContainer dependency instead of a WindsorContainer.
|
# ¿ Jun 23, 2015 04:29 |
|
Code First Existing Database Entity Framework Question I'm using Code First with its fluent type configurations currently. I'd like to transform the following table into the following model. Existing Database: code:
code:
code:
code:
Is this even possible or am I going to need to mess around with extending the Customer and Phone classes to create "proxy" classes and then "newing" properties in the derived types? There's also another issue that phone number values are stuffed in other columns of other tables as well.
|
# ¿ Nov 7, 2015 00:00 |
|
Inverness posted:Why not simply have Phone, WorkPhone, and CellPhone properties in the Customer class as it is shown in the existing database? The existing database is but one system of several that I need to bring together into a common model. In your example, what if a customer had several cell phones? Why stop at those 3 types of phones? We now have [num of phone type] lists as properties of a customer. I'd prefer one list as a property which is a bit more extensible imo. Sedro posted:You could throw in a computed property for Phones and have your ORM ignore it That's what I was working towards today but it was getting messy with logic in properties, unnecessary inheritance, etc. I wanted to see if I was just completely missing something obvious.
|
# ¿ Nov 7, 2015 03:04 |
|
crashdome posted:Personally, I would start with the database. Have the DBA (or yourself if that's the case) run a procedure to extract the phone #s to another table. Then code to that. I would love to but the table is currently backing an old and not going away anytime soon large support application with a lot of traffic. The question remains; is this a roll-your-own scenario?
|
# ¿ Nov 7, 2015 06:37 |
|
Why would a sql query generated from Entity Framework take minutes to execute, yet when the same query is run within SSMS, it takes less than a second? Entity Framework 6.1.3 SQL Server 2005 Enterprise I'm grabbing the sql generated using the Infrastructure Interception DatabaseLogger registered in web.config. I'm unable to trace or profile in SSMS due to a current lack of permissions so I don't have any other details yet.
|
# ¿ Dec 4, 2015 17:54 |
|
Calidus posted:Are you by chance doing a insert? In my experience entity inserts are terribly slow. Entity also seems to take a larger performance hit do to missing keys and indexes than raw sql. It's a simple select, top 100 from table_x, joined to table_y. Filters are on a few table_y columns. The database has no constraints and I'm not sure the indexes it does have are even relevant. Hard to tell until I can get additional db permissions.
|
# ¿ Dec 4, 2015 18:25 |
|
epalm posted:Automapper mapping configurations Separate your models from how your models are mapped. https://en.wikipedia.org/wiki/Single_responsibility_principle I also recommend looking into using Automapper non-statically. Testing is a bit easier. Configure mappings via Profiles then inject in IMappingEngine instances as needed to map.
|
# ¿ Dec 8, 2015 03:55 |
|
|
# ¿ May 4, 2024 17:36 |
|
fleshweasel posted:What does it enable you to test? That your program still works even if you substitute in some other Automapper implementation? Injecting interfaces allows for easier testing, especially when using Moq. Mock<>.Verify is a great way to ensure things are called or not called. Using static classes just makes things more difficult to test. And I agree with your second point in theory, I just haven't seen a case where the situation called for mapping between tiers/systems and Automapper was unable to do it cleanly and consistently.
|
# ¿ Dec 9, 2015 06:38 |