Search Results

Search found 53 results on 3 pages for 'unitofwork'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Resolution Problem with HttpRequestScoped in Autofac

    - by Page Brooks
    I'm trying to resolve the AccountController in my application, but it seems that I have a lifetime scoping issue. builder.Register(c => new MyDataContext(connectionString)).As<IDatabase>().HttpRequestScoped(); builder.Register(c => new UnitOfWork(c.Resolve<IDatabase>())).As<IUnitOfWork>().HttpRequestScoped(); builder.Register(c => new AccountService(c.Resolve<IDatabase>())).As<IAccountService>().InstancePerLifetimeScope(); builder.Register(c => new AccountController(c.Resolve<IAccountService>())).InstancePerDependency(); I need MyDataContext and UnitOfWork to be scoped at the HttpRequestLevel. When I try to resolve the AccountController, I get the following error: No scope matching the expression 'value(Autofac.Builder.RegistrationBuilder`3+<c__DisplayClass0[...]).lifetimeScopeTag.Equals(scope.Tag)' is visible from the scope in which the instance was requested. Do I have my dependency lifetimes set up incorrectly?

    Read the article

  • How to create multiple Repository object inside a Repository class using Unit Of Work?

    - by Santosh
    I am newbie to MVC3 application development, currently, we need following Application technologies as requirement MVC3 framework IOC framework – Autofac to manage object creation dynamically Moq – Unit testing Entity Framework Repository and Unit Of Work Pattern of Model class I have gone through many article to explore an basic idea about the above points but still I am little bit confused on the “Repository and Unit Of Work Pattern “. Basically what I understand Unit Of Work is a pattern which will be followed along with Repository Pattern in order to share the single DB Context among all Repository object, So here is my design : IUnitOfWork.cs public interface IUnitOfWork : IDisposable { IPermitRepository Permit_Repository{ get; } IRebateRepository Rebate_Repository { get; } IBuildingTypeRepository BuildingType_Repository { get; } IEEProjectRepository EEProject_Repository { get; } IRebateLookupRepository RebateLookup_Repository { get; } IEEProjectTypeRepository EEProjectType_Repository { get; } void Save(); } UnitOfWork.cs public class UnitOfWork : IUnitOfWork { #region Private Members private readonly CEEPMSEntities context = new CEEPMSEntities(); private IPermitRepository permit_Repository; private IRebateRepository rebate_Repository; private IBuildingTypeRepository buildingType_Repository; private IEEProjectRepository eeProject_Repository; private IRebateLookupRepository rebateLookup_Repository; private IEEProjectTypeRepository eeProjectType_Repository; #endregion #region IUnitOfWork Implemenation public IPermitRepository Permit_Repository { get { if (this.permit_Repository == null) { this.permit_Repository = new PermitRepository(context); } return permit_Repository; } } public IRebateRepository Rebate_Repository { get { if (this.rebate_Repository == null) { this.rebate_Repository = new RebateRepository(context); } return rebate_Repository; } } } PermitRepository .cs public class PermitRepository : IPermitRepository { #region Private Members private CEEPMSEntities objectContext = null; private IObjectSet<Permit> objectSet = null; #endregion #region Constructors public PermitRepository() { } public PermitRepository(CEEPMSEntities _objectContext) { this.objectContext = _objectContext; this.objectSet = objectContext.CreateObjectSet<Permit>(); } #endregion public IEnumerable<RebateViewModel> GetRebatesByPermitId(int _permitId) { // need to implment } } PermitController .cs public class PermitController : Controller { #region Private Members IUnitOfWork CEEPMSContext = null; #endregion #region Constructors public PermitController(IUnitOfWork _CEEPMSContext) { if (_CEEPMSContext == null) { throw new ArgumentNullException("Object can not be null"); } CEEPMSContext = _CEEPMSContext; } #endregion } So here I am wondering how to generate a new Repository for example “TestRepository.cs” using same pattern where I can create more then one Repository object like RebateRepository rebateRepo = new RebateRepository () AddressRepository addressRepo = new AddressRepository() because , what ever Repository object I want to create I need an object of UnitOfWork first as implmented in the PermitController class. So if I would follow the same in each individual Repository class that would again break the priciple of Unit Of Work and create multiple instance of object context. So any idea or suggestion will be highly appreciated. Thank you

    Read the article

  • Application_EndRequest Dosent Fire on a 404

    - by Shane
    I am using ASP MVC 2 and Nhibernate. I have created an HTTP Module as demonstrated in Summer of NHibernate 13 that looks like so: public void Init(HttpApplication context) { context.PreRequestHandlerExecute += new EventHandler(Application_BeginRequest); context.PostRequestHandlerExecute += new EventHandler(Application_EndRequest); } private void Application_BeginRequest(object sender, EventArgs e) { ISession session = StaticSessionManager.OpenSession(); session.BeginTransaction(); CurrentSessionContext.Bind(session); } private void Application_EndRequest(object sender, EventArgs e) { ISession session = CurrentSessionContext.Unbind(StaticSessionManager.SessionFactory); if (session != null) try { session.Transaction.Commit(); } catch (Exception) { session.Transaction.Rollback(); } finally { session.Flush(); session.Close(); } } web.config <add name="UnitOfWork" type="HttpModules.UnitOfWork"/> My problem is that Application_EndRequest never gets called on a 404 error so if my view does not render I completely block database access until my flush takes place. I am fairly new to NHibernate so I am not sure if I am missing something.

    Read the article

  • Service Layer are repeating my Repositories

    - by Felipe
    Hi all, I'm developing an application using asp.net mvc, NHibernate and DDD. I have a service layer that are used by controllers of my application. Everything are using Unity to inject dependencies (ISessionFactory in repositories, repositories in services and services in controllers) and works fine. But, it's very common I need a method in service to get only object in my repository, like this (in service class): public class ProductService { private readonly IUnitOfWork _uow; private readonly IProductRepository _productRepository; public ProductService(IUnitOfWork unitOfWork, IProductRepository productRepository) { this._uow = unitOfWork; this._productRepository = productRepository; } /* this method should be exists in DDD ??? It's very common */ public Domain.Product Get(long key) { return _productRepository.Get(key); } /* other common method... is correct by DDD ? */ public bool Delete(long key) { usign (var tx = _uow.BeginTransaction()) { try { _productRepository.Delete(key); tx.Commit(); return true; } catch { tx.RollBack(); return false; } } } /* ... others methods ... */ } This code is correct by DDD ? For each Service class I have a Repository, and for each service class need I do a method "Get" for an entity ? Thanks guys Cheers

    Read the article

  • Best C# database communication technique

    - by user65439
    A few days ago I read a reply to a question where people said that the days of writing queries within your c# code are long gone. I'm not sure what the specific person meant with the comment but it got me thinking. At the company I'm currently working at we maintain an assembly containing all the queries to the database (let's call it Queries), this assembly is reference by a QueryService (Retrieve the correct queries) assembly which in turn is referenced by a UnitOfWork assembly (The database connector classes, we have different connector classes for SQL, MySQL etc.). We use these three assemblies to perform operations on our database and all queries/commands are written in our C# code. Is there a better way to communicate with the database and is there a better way to communicate with different database types?

    Read the article

  • How should I implement the repository pattern for complex object models?

    - by Eric Falsken
    Our data model has almost 200 classes that can be separated out into about a dozen functional areas. It would have been nice to use domains, but the separation isn't that clean and we can't change it. We're redesigning our DAL to use Entity Framework and most of the recommendations that I've seen suggest using a Repository pattern. However, none of the samples really deal with complex object models. Some implementations that I've found suggest the use of a repository-per-entity. This seems ridiculous and un-maintainable for large, complex models. Is it really necessary to create a UnitOfWork for each operation, and a Repository for each entity? I could end up with thousands of classes. I know this is unreasonable, but I've found very little guidance implementing Repository, Unit Of Work, and Entity Framework over complex models and realistic business applications.

    Read the article

  • NHibernate with StructureMap for a Non-Web Application

    - by Yoann. B
    Hi, What is best pratices for inject and manage Session/Transaction for NHibernate using StructureMap for a Non Web Application like an Windows Service ? In a web context, we use PerRequest Session management lifecycle using the Hybrid Lifecycle of StructureMap but for a Windows Service, i can't handle IDisposable UnitOfWork ... Thanks.

    Read the article

  • Domain Model + LINQ to SQL sample

    - by lmsasu
    Hello all, I wonder if there is an enterprise application sample, designed with Domain Model in the Business Logic layer and LINQ for the Data Mapper? I'm not so sure of how to use the UnitOfWork ability of LINQ to SQL in conjunction with business objects from the Business Layer. Thanks, Lucian

    Read the article

  • MvcExtensions – Bootstrapping

    - by kazimanzurrashid
    When you create a new ASP.NET MVC application you will find that the global.asax contains the following lines: namespace MvcApplication1 { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } } } As the application grows, there are quite a lot of plumbing code gets into the global.asax which quickly becomes a design smell. Lets take a quick look at the code of one of the open source project that I recently visited: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("Default","{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" }); } protected override void OnApplicationStarted() { Error += OnError; EndRequest += OnEndRequest; var settings = new SparkSettings() .AddNamespace("System") .AddNamespace("System.Collections.Generic") .AddNamespace("System.Web.Mvc") .AddNamespace("System.Web.Mvc.Html") .AddNamespace("MvcContrib.FluentHtml") .AddNamespace("********") .AddNamespace("********.Web") .SetPageBaseType("ApplicationViewPage") .SetAutomaticEncoding(true); #if DEBUG settings.SetDebug(true); #endif var viewFactory = new SparkViewFactory(settings); ViewEngines.Engines.Add(viewFactory); #if !DEBUG PrecompileViews(viewFactory); #endif RegisterAllControllersIn("********.Web"); log4net.Config.XmlConfigurator.Configure(); RegisterRoutes(RouteTable.Routes); Factory.Load(new Components.WebDependencies()); ModelBinders.Binders.DefaultBinder = new Binders.GenericBinderResolver(Factory.TryGet<IModelBinder>); ValidatorConfiguration.Initialize("********"); HtmlValidationExtensions.Initialize(ValidatorConfiguration.Rules); } private void OnEndRequest(object sender, System.EventArgs e) { if (((HttpApplication)sender).Context.Handler is MvcHandler) { CreateKernel().Get<ISessionSource>().Close(); } } private void OnError(object sender, System.EventArgs e) { CreateKernel().Get<ISessionSource>().Close(); } protected override IKernel CreateKernel() { return Factory.Kernel; } private static void PrecompileViews(SparkViewFactory viewFactory) { var batch = new SparkBatchDescriptor(); batch.For<HomeController>().For<ManageController>(); viewFactory.Precompile(batch); } As you can see there are quite a few of things going on in the above code, Registering the ViewEngine, Compiling the Views, Registering the Routes/Controllers/Model Binders, Settings up Logger, Validations and as you can imagine the more it becomes complex the more things will get added in the application start. One of the goal of the MVCExtensions is to reduce the above design smell. Instead of writing all the plumbing code in the application start, it contains BootstrapperTask to register individual services. Out of the box, it contains BootstrapperTask to register Controllers, Controller Factory, Action Invoker, Action Filters, Model Binders, Model Metadata/Validation Providers, ValueProvideraFactory, ViewEngines etc and it is intelligent enough to automatically detect the above types and register into the ASP.NET MVC Framework. Other than the built-in tasks you can create your own custom task which will be automatically executed when the application starts. When the BootstrapperTasks are in action you will find the global.asax pretty much clean like the following: public class MvcApplication : UnityMvcApplication { public void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e) { Check.Argument.IsNotNull(e, "e"); HttpException exception = e.Exception.GetBaseException() as HttpException; if ((exception != null) && (exception.GetHttpCode() == (int)HttpStatusCode.NotFound)) { e.Dismiss(); } } } The above code is taken from my another open source project Shrinkr, as you can see the global.asax is longer cluttered with any plumbing code. One special thing you have noticed that it is inherited from the UnityMvcApplication rather than regular HttpApplication. There are separate version of this class for each IoC Container like NinjectMvcApplication, StructureMapMvcApplication etc. Other than executing the built-in tasks, the Shrinkr also has few custom tasks which gets executed when the application starts. For example, when the application starts, we want to ensure that the default users (which is specified in the web.config) are created. The following is the custom task that is used to create those default users: public class CreateDefaultUsers : BootstrapperTask { protected override TaskContinuation ExecuteCore(IServiceLocator serviceLocator) { IUserRepository userRepository = serviceLocator.GetInstance<IUserRepository>(); IUnitOfWork unitOfWork = serviceLocator.GetInstance<IUnitOfWork>(); IEnumerable<User> users = serviceLocator.GetInstance<Settings>().DefaultUsers; bool shouldCommit = false; foreach (User user in users) { if (userRepository.GetByName(user.Name) == null) { user.AllowApiAccess(ApiSetting.InfiniteLimit); userRepository.Add(user); shouldCommit = true; } } if (shouldCommit) { unitOfWork.Commit(); } return TaskContinuation.Continue; } } There are several other Tasks in the Shrinkr that we are also using which you will find in that project. To create a custom bootstrapping task you have create a new class which either implements the IBootstrapperTask interface or inherits from the abstract BootstrapperTask class, I would recommend to start with the BootstrapperTask as it already has the required code that you have to write in case if you choose the IBootstrapperTask interface. As you can see in the above code we are overriding the ExecuteCore to create the default users, the MVCExtensions is responsible for populating the  ServiceLocator prior calling this method and in this method we are using the service locator to get the dependencies that are required to create the users (I will cover the custom dependencies registration in the next post). Once the users are created, we are returning a special enum, TaskContinuation as the return value, the TaskContinuation can have three values Continue (default), Skip and Break. The reason behind of having this enum is, in some  special cases you might want to skip the next task in the chain or break the complete chain depending upon the currently running task, in those cases you will use the other two values instead of the Continue. The last thing I want to cover in the bootstrapping task is the Order. By default all the built-in tasks as well as newly created task order is set to the DefaultOrder(a static property), in some special cases you might want to execute it before/after all the other tasks, in those cases you will assign the Order in the Task constructor. For Example, in Shrinkr, we want to run few background services when the all the tasks are executed, so we assigned the order as DefaultOrder + 1. Here is the code of that Task: public class ConfigureBackgroundServices : BootstrapperTask { private IEnumerable<IBackgroundService> backgroundServices; public ConfigureBackgroundServices() { Order = DefaultOrder + 1; } protected override TaskContinuation ExecuteCore(IServiceLocator serviceLocator) { backgroundServices = serviceLocator.GetAllInstances<IBackgroundService>().ToList(); backgroundServices.Each(service => service.Start()); return TaskContinuation.Continue; } protected override void DisposeCore() { backgroundServices.Each(service => service.Stop()); } } That’s it for today, in the next post I will cover the custom service registration, so stay tuned.

    Read the article

  • Domain Validation in a CQRS architecture

    - by Jupaol
    Basically I want to know if there is a better way to validate my domain entities. This is how I am planning to do it but I would like your opinion The first approach I considered was: class Customer : EntityBase<Customer> { public void ChangeEmail(string email) { if(string.IsNullOrWhitespace(email)) throw new DomainException(“...”); if(!email.IsEmail()) throw new DomainException(); if(email.Contains(“@mailinator.com”)) throw new DomainException(); } } I actually do not like this validation because even when I am encapsulating the validation logic in the correct entity, this is violating the Open/Close principle (Open for extension but Close for modification) and I have found that violating this principle, code maintenance becomes a real pain when the application grows up in complexity. Why? Because domain rules change more often than we would like to admit, and if the rules are hidden and embedded in an entity like this, they are hard to test, hard to read, hard to maintain but the real reason why I do not like this approach is: if the validation rules change, I have to come and edit my domain entity. This has been a really simple example but in RL the validation could be more complex So following the philosophy of Udi Dahan, making roles explicit, and the recommendation from Eric Evans in the blue book, the next try was to implement the specification pattern, something like this class EmailDomainIsAllowedSpecification : IDomainSpecification<Customer> { private INotAllowedEmailDomainsResolver invalidEmailDomainsResolver; public bool IsSatisfiedBy(Customer customer) { return !this.invalidEmailDomainsResolver.GetInvalidEmailDomains().Contains(customer.Email); } } But then I realize that in order to follow this approach I had to mutate my entities first in order to pass the value being valdiated, in this case the email, but mutating them would cause my domain events being fired which I wouldn’t like to happen until the new email is valid So after considering these approaches, I came out with this one, since I am going to implement a CQRS architecture: class EmailDomainIsAllowedValidator : IDomainInvariantValidator<Customer, ChangeEmailCommand> { public void IsValid(Customer entity, ChangeEmailCommand command) { if(!command.Email.HasValidDomain()) throw new DomainException(“...”); } } Well that’s the main idea, the entity is passed to the validator in case we need some value from the entity to perform the validation, the command contains the data coming from the user and since the validators are considered injectable objects they could have external dependencies injected if the validation requires it. Now the dilemma, I am happy with a design like this because my validation is encapsulated in individual objects which brings many advantages: easy unit test, easy to maintain, domain invariants are explicitly expressed using the Ubiquitous Language, easy to extend, validation logic is centralized and validators can be used together to enforce complex domain rules. And even when I know I am placing the validation of my entities outside of them (You could argue a code smell - Anemic Domain) but I think the trade-off is acceptable But there is one thing that I have not figured out how to implement it in a clean way. How should I use this components... Since they will be injected, they won’t fit naturally inside my domain entities, so basically I see two options: Pass the validators to each method of my entity Validate my objects externally (from the command handler) I am not happy with the option 1 so I would explain how I would do it with the option 2 class ChangeEmailCommandHandler : ICommandHandler<ChangeEmailCommand> { public void Execute(ChangeEmailCommand command) { private IEnumerable<IDomainInvariantValidator> validators; // here I would get the validators required for this command injected, and in here I would validate them, something like this using (var t = this.unitOfWork.BeginTransaction()) { var customer = this.unitOfWork.Get<Customer>(command.CustomerId); this.validators.ForEach(x =. x.IsValid(customer, command)); // here I know the command is valid // the call to ChangeEmail will fire domain events as needed customer.ChangeEmail(command.Email); t.Commit(); } } } Well this is it. Can you give me your thoughts about this or share your experiences with Domain entities validation EDIT I think it is not clear from my question, but the real problem is: Hiding the domain rules has serious implications in the future maintainability of the application, and also domain rules change often during the life-cycle of the app. Hence implementing them with this in mind would let us extend them easily. Now imagine in the future a rules engine is implemented, if the rules are encapsulated outside of the domain entities, this change would be easier to implement

    Read the article

  • Swapping from NHibernate to Entity Framework &ndash; Sanity Check

    - by DesigningCode
    Now I’m not an expert in either of these techs.  I have a nice framework for unit of work / repository built with NHibernate.  Works pretty well.  I use FluentNhibernate to do the mappings.  Works well.  Takes very little code to get going with a DB back OO model. So why swap? Linq.  In Entity Framework you get much better linq support.  Visibility. I have no idea what's really happening with NHibernate….its a cloud of mystery most of the time.  You have to read all the blogs, mailing lists, etc to know what's going on. So, EF 4.0 looks like pretty good….  it has reasonably good support for mapping POCOs.  Wrapping UnitOfWork and Repository around it seems ok. Only thing I haven’t liked too much is having to explicitly load lazy loading entities. So…. am I sane?  is EF the way to go?  or is NHibernate going to suddenly release the next generation of coolness?  Is there any other major gotchas of using EF over NHibernate?

    Read the article

  • CodePlex Daily Summary for Tuesday, March 06, 2012

    CodePlex Daily Summary for Tuesday, March 06, 2012Popular ReleasesTortoiseHg: TortoiseHg 2.3.1: bugfix releaseSimple Injector: Simple Injector v1.4.1: This release adds two small improvements to the SimpleInjector.Extensions.dll. No changes have been made to the core library. New features and improvements in this release for the SimpleInjector.Extensions.dll The RegisterManyForOpenGeneric extension methods now accept non-generic decorator, as long as they implement the given open generic service type. GetTypesToRegister methods added to the OpenGenericBatchRegistrationExtensions class which allows to customize the behavior. Note that the...SQL Scriptz Runner: Application: Scriptz Runner source code and applicationCommonLibrary: Code: CodePowerGUI Visual Studio Extension: PowerGUI VSX 1.5.2: Added support for PowerGUI 3.2.VidCoder: 1.3.1: Updated HandBrake core to 0.9.6 release (svn 4472). Removed erroneous "None" container choice. Change some logic and help text to stop assuming you have to pick the VIDEO_TS folder for a DVD scan. This should make previewing DVD titles on the Queue Multiple Titles window possible when you've picked the root DVD directory.VitaNexCore: VitaNexCore BC 2.1: Everything you need to get started!NUnitTestHelper: NUnitTestHelper_version_1_0_0: Version 1.0 release. With samples included.ASP.NET MVC Framework - Abstracting Data Annotations, HTML5, Knockout JS techs: Version 1.0: Please download the source code. I am not associating any dll for release.ExtAspNet: ExtAspNet v3.1.0: ExtAspNet - ?? ExtJS ??? ASP.NET 2.0 ???,????? AJAX ?????????? ExtAspNet ????? ExtJS ??? ASP.NET 2.0 ???,????? AJAX ??????????。 ExtAspNet ??????? JavaScript,?? CSS,?? UpdatePanel,?? ViewState,?? WebServices ???????。 ??????: IE 7.0, Firefox 3.6, Chrome 3.0, Opera 10.5, Safari 3.0+ ????:Apache License 2.0 (Apache) ??:http://extasp.net/ ??:http://bbs.extasp.net/ ??:http://extaspnet.codeplex.com/ ??:http://sanshi.cnblogs.com/ ????: +2012-03-04 v3.1.0 -??Hidden???????(〓?〓)。 -?PageManager??...AcDown????? - Anime&Comic Downloader: AcDown????? v3.9.1: ?? ●AcDown??????????、??、??????,????1M,????,????,?????????????????????????。???????????Acfun、????(Bilibili)、??、??、YouTube、??、???、??????、SF????、????????????。??????AcPlay?????,??????、????????????????。 ● AcDown???????????????????????????,???,???????????????????。 ● AcDown???????C#??,????.NET Framework 2.0??。?????"Acfun?????"。 ????32??64? Windows XP/Vista/7/8 ????????????? ??:????????Windows XP???,?????????.NET Framework 2.0???(x86),?????"?????????"??? ??????????????,??????????: ??"AcDo...Windows Phone Commands for VS2010: Version 1.0: Initial Release Version 1.0 Connect from device or emulator (Monitors the connection) Show Device information (Plataform, build , version, avaliable memory, total memory, architeture Manager installed applications (Launch, uninstall and explorer isolate storage files) Manager core applications (Launch blocked applications from emulator (Office, Calculator, alarm, calendar , etc) Manager blocked settings from emulator (Airplane Mode, Celullar Network, Wifi, etc) Deploy and update ap...DNN Metro7 style Skin package: Metro7 style Skin for DotNetNuke 06.01.00: Changes on Version 06.01.00 Fixed issue on GraySmallTitle container, that breaks the layout Fixed issue on Blue Metro7 Skin where the Search, Login, Register, Date is missing Fixed issue with the Version numbers on the target file Fixed issue where the jQuery and jQuery-UI files not deleted on upgrade from Version 01.00.00 Added a internal page where the Image Slider would be replaces with a BannerPaneMedia Companion: MC 3.433b Release: General More GUI tweaks (mostly imperceptible!) Updates for mc_com.exe TV The 'Watched' button has been re-instigated Added TV Menu sub-option to search ALL for new Episodes (includes locked shows) Movies Added 'Source' field (eg DVD, Bluray, HDTV), customisable in Advanced Preferences (try it out, let us know how it works!) Added HTML <<format>> tag with optional parameters for video container, source, and resolution (updated HTML tags to be added to Documentation shortly) Known Issu...Picturethrill: Version 2.3.2.0: Release includes Self-Update feature for Picturethrill. What that means for users is that they are always guaranteed to have a fresh copy of Picturethrill on their computers with all latest fixes. When Picturethrill adds a new website to get pictures from, you will get it too!Simple MVVM Toolkit for Silverlight, WPF and Windows Phone: Simple MVVM Toolkit v3.0.0.0: Added support for Silverlight 5.0 and Windows Phone 7.1. Upgraded project templates and samples. Upgraded installer. There are some new prerequisites required for this version, namely Silverlight 5 Tools, Expression Blend Preview for Silverlight 5 (until the SDK is released), Windows Phone 7.1 SDK. Because it is in the experimental band, I have also removed the dependency on the Silverlight Testing Framework. You can use it if you wish, but the Ria Services project template no longer uses ...CODE Framework: 4.0.20301: The latest version adds a number of new features to the WPF system (such as stylable and testable messagebox support) as well as various new features throughout the system (especially in the Utilities namespace).MyRouter (Virtual WiFi Router): MyRouter 1.0.2 (Beta): A friendlier User Interface. A logger file to catch exceptions so you may send it to use to improve and fix any bugs that may occur. A feedback form because we always love hearing what you guy's think of MyRouter. Check for update menu item for you to stay up to date will the latest changes. Facebook fan page so you may spread the word and share MyRouter with friends and family And Many other exciting features were sure your going to love!WPF Sound Visualization Library: WPF SVL 0.3 (Source, Binaries, Examples, Help): Version 0.3 of WPFSVL. This includes three new controls: an equalizer, a digital clock, and a time editor.Orchard Project: Orchard 1.4: Please read our release notes for Orchard 1.4: http://docs.orchardproject.net/Documentation/Orchard-1-4-Release-NotesNew Projectsbinbin unitofwork: binbin unitofworkBreezeExtension: This is a test-bed for me to learn Visual Studio extension development. Hopefully it will lead to some useful tools. The project is written in C# utilising the Visual Studio 2010 SDK.CatFinder: Small device for animal trackingChampagne Gala Store: SATELITE of dankfu.com. ChampagneGala/Belligerent Tent/Games and I/EDrinking Games are patented. Post this Gadget to your desktop and have local grocers/vendors deliver your products the same day! This program is still in Beta of another Gadget cmgsoon GrocerShop local deliveryCSharpShortcutsLibrary: Believe it or not, there is no easy way to create a shortcut in C#! At least, there wasn't before now. Add this library and simply say "CreateLink(shortcutPath, shortcutName, targetFile, out sError, iconLocation);" and you're done! DBLint: DBLint is an automated tool for analyzing database designs. DBLints ensures a consistent and maintainable database design by identifying bad design patterns. The output from DBLint is a report containing a detailed description of all found issues and the database structureDebugHelpers: DebugHelpers is/will be a collection of utilities that work along with other debugging tools such as WinDbg and CDB with a focus on managed .NET debugging. The first utility is the HeapView. HeapView enables you to easily analyze multiple results of the SOS !DumpHeap command and find which objects are growing over time.eLab: eLabEnterprise Software Architecture: Demonstration of Enterprise Software Architecture in C#EntityFrameworkGenericRepository: We wrote your data layer so you don't have to. Developed at ettaingroup for our clients. We found that we were using the same patterns over and over again. So we developed this data framework. It uses Entity Framework 4.2, DbContext and POCO's. The Generic Repository library allows flexible, LINQ-enabled access to your data with full TransactionScope support using UnitOfWork for data manipulation.ezFrameWork: Php FrameworkGeeXploreR: File Explorer for Geek :) Based on: * Windows 7 File Explorer UI * Chrome UI and Workflow * other Files Explorer * other Files toolsImage Processing & Recognition: Game controll with Image Processing.iPolice: KTU demo projectJustListen????: JustListen????(??:????Windows???),??.NetFramework 4.0??,??Windows Presentation Foundation(WPF)??????,????C#????,UI????????,????????!????????????26?????、3???DJ????2?????,?????????????!Krempel's Windows Phone 7 project: This is a project where Matthijs Krempel posts all his code snippets.lib12: Library of useful classes and functions for .NetLibium: LibraryLigueM2L_ANGLADE: Projet d'étude. Annuaire de la Maison des ligues.LLS.Core - A simple ORM Framework with three layer architecture using reflection: A simple ORM Framework with the power to load, save, update, delete and count data in a database. Uses reflection to execute SQL commands on a database and adopts the three-tier architecture to make the code cleaner and easier maintenance.MarketCar: Testing ProjectMicrosoft Project Server History Tracking: A simple application to help users track Microsoft Project Server historical data using the Microsoft BI Suite. The solution will help answer the following question: "What was the project status last week?" "What should I focus on since the last status report?" The solution does not require any knowledge of coding or SQL, and leverages various wizards in the Microsoft Business Intelligence suite to build a foundation for tracking Project Server historical data. It is expected that ...mysshop: start workingOrchard Custom Forms Module: Lets you create custom forms like contact forms or content contributions.Project Light: F10 IndustruesRecognition of good food: Recognition of good foodschool15: A web site base on ThinkPHPStorage Managment System: Storage Managment SystemSWShowPermissions: SWShowPermissions includes a treeview web part that iterates over all webs in a sitecollection and indicates whether the logged in user has permissions on it or not. What permissions are decisive can be configured through the WebPart properties.Testable DNN Module Using MVP Pattern: There is a testable module project for DNN in codeplex, but it VB version. So I decided to create a C# one by using MVP pattern. Touch Mouse Mate: A utility that adds more features to Microsoft Touch Mouse. Currently middle click and touch-over-click are supported. More will be added later.TraceMyItems!: PMC HEZ BACDUnattended Installer: An Unattended Installer for your setup files. this tiny tool designed for helping people in installing multiple applications in 3 easy steps. Visual Studio Coded UI Microsoft Word Add-in: Visual Studio ALM Rangers tooling and guidance for the Visual Studio Coded UI Microsoft Word Add-in, which extends the Coded UI feature support to Microsoft Word documents.???? ?????: ???????? ?????? ?? ????? ???????????? ????? ????? 2.

    Read the article

  • ASP.NET MVC does not add ModelError when invoking from unit test

    - by Tomas Lycken
    I have a model item public class EntryInputModel { ... [Required(ErrorMessage = "Description is required.", AllowEmptyStrings = false)] public virtual string Description { get; set; } } and a controller action public ActionResult Add([Bind(Exclude = "Id")] EntryInputModel newEntry) { if (ModelState.IsValid) { var entry = Mapper.Map<EntryInputModel, Entry>(newEntry); repository.Add(entry); unitOfWork.SaveChanges(); return RedirectToAction("Details", new { id = entry.Id }); } return RedirectToAction("Create"); } When I create an EntryInputModel in a unit test, set the Description property to null and pass it to the action method, I still get ModelState.IsValid == true, even though I have debugged and verified that newEntry.Description == null. Why doesn't this work?

    Read the article

  • asp.net mvc crazy error

    - by bongoo
    Hi there im having a weird error which is related to an earlier post , I am checking if a file exists before downloading. This works for pdf's but not for any other type of document here is my controller action and the typical path for a pdf and a powerpoint file , the powerpoint does not work ~/Documents//FID//TestDoc//27a835a5-bf70-4599-8606-6af64b33945d/FIDClasses.pdf ~/Documents//FID//pptest//ce36e7a0-14de-41f3-8eb7-0d543c7146fe/PPttest.ppt [UnitOfWork] public ActionResult Download(int id) { Document doc = _documentRepository.GetById(id); if (doc != null) { if (System.IO.File.Exists(Server.MapPath(doc.filepath))) { _downloadService.AddDownloadsForDocument(doc.document_id, _UserService.CurrentUser().user_id); return File(doc.filepath, doc.mimetype, doc.title); } } return RedirectToAction("Index"); }

    Read the article

  • Session is Closed! NHibernate shouldn't be trying to grab data

    - by Jeremy Holovacs
    I have a UnitOfWork/Service pattern where I populate my model using NHibernate before sending it to the view. For some reason I still get the YSOD, and I don't understand why the object collection is not already populated. My controller method looks like this: public ActionResult PendingRegistrations() { var model = new PendingRegistrationsModel(); using (var u = GetUnitOfWork()) { model.Registrations = u.UserRegistrations.GetRegistrationsPendingAdminApproval(); } return View(model); } The service/unit of work looks like this: public partial class NHUserRegistrationRepository : IUserRegistrationRepository { public IEnumerable<UserRegistration> GetRegistrationsPendingAdminApproval() { var r = from UserRegistration ur in _Session.Query<UserRegistration>() where ur.Status == AccountRegistrationStatus.PendingAdminReview select ur; NHibernateUtil.Initialize(r); return r; } } What am I doing wrong?

    Read the article

  • No Parameterless Constructor defined for - ViewModel with UOW

    - by TheVillageIdiot
    I have a view model class which uses UnitOfWork to some database operations like fetching of items to create select lists and IPrincipal for some auditing (like modified by etc.). It cannot work without this UOW. I have configured my web site to use Ninject to inject UOW into Controllers. From controller I pass this UOW when creating view model. But when performing POST operation I am getting No parameterless constructor defined for this object. I have few SelectList type of properties which I have excluded with Bind attribute. How can I overcome this problem? Can I configure Ninject to create the objects of this type and make ModelBinder use it?

    Read the article

  • NHibernate L2 Cache - fluent nHibernate configuration

    - by AWC
    I've managed to configure the L2 cache for Get\Load in FHN, but it's not working for queries configured using the ICriteria interface - it doesn't cache the results from these queries. Does anyone know why? The configurations are as follows: ICriteria: return unitOfWork .CurrentSession .CreateCriteria(typeof(Country)) .SetCacheable(true); Entity Mapping: public sealed class CountryMap : ClassMap<Country>, IMap { public CountryMap() { Table("Countries"); Not.LazyLoad(); Cache.ReadWrite().IncludeAll(); Id(x => x.Id); Map(x => x.TwoLetter); Map(x => x.ThreeLetter); Map(x => x.Name); } } And the session factory configuration for the database property: return () => MsSqlConfiguration.MsSql2005 .ConnectionString(BuildConnectionString()) .ShowSql() .Cache(c => c.UseQueryCache() .QueryCacheFactory<StandardQueryCacheFactory>() .ProviderClass(configuration.RepositoryCacheType) .UseMinimalPuts()) .FormatSql() .UseReflectionOptimizer(); Cheers AWC

    Read the article

  • Why 'timeout expired' exception thrown with StructureMap?

    - by Martin
    I'm getting a "timeout expired" exception thrown from a relatively heavily trafficked ASP.NET MVC 2 site I developed using StructureMap and Fluent NHibernate. I think that perhaps the connections aren't being disposed properly. What do you think may be causing this? Could it be my use of InstanceScope.Hybrid? Here's my NHibernateRegistry class; thanks in advance for your help: using MyProject.Core.Persistence.Impl; using FluentNHibernate.Cfg; using FluentNHibernate.Cfg.Db; using NHibernate; using NHibernate.ByteCode.LinFu; using NHibernate.Cfg; using MyProject.Core.FluentMapping; using StructureMap.Attributes; using StructureMap.Configuration.DSL; namespace MyProject.Core.Persistence { public class NHibernateRegistry : Registry { public NHibernateRegistry() { FluentConfiguration cfg = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString( x => x.FromConnectionStringWithKey( "MyConnectionString")) .ProxyFactoryFactory(typeof (ProxyFactoryFactory).AssemblyQualifiedName)) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<EntryMap>()); Configuration configuration = cfg.BuildConfiguration(); ISessionFactory sessionFactory = cfg.BuildSessionFactory(); ForRequestedType<Configuration>().AsSingletons() .TheDefault.IsThis(configuration); ForRequestedType<ISessionFactory>().AsSingletons() .TheDefault.IsThis(sessionFactory); ForRequestedType<ISession>().CacheBy(InstanceScope.Hybrid) .TheDefault.Is.ConstructedBy(ctx => ctx.GetInstance<ISessionFactory>().OpenSession()); ForRequestedType<IUnitOfWork>().CacheBy(InstanceScope.Hybrid) .TheDefaultIsConcreteType<UnitOfWork>(); ForRequestedType<IDatabaseBuilder>().TheDefaultIsConcreteType<DatabaseBuilder>(); } } }

    Read the article

  • Why is my Lucene index getting locked?

    - by Andrew Bullock
    I had an issue with my search not return the results I expect. I tried to run Luke on my index, but it said it was locked and I needed to Force Unlock it (I'm not a Jedi/Sith though) I tried to delete the index folder and run my recreate-indicies application but the folder was locked. Using unlocker I've found that there are about 100 entries of w3wp.exe (same PID, different Handle) with a lock on the index. Whats going on? I'm doing this in my NHibernate configuration: c.SetListener(ListenerType.PostUpdate, new FullTextIndexEventListener()); c.SetListener(ListenerType.PostInsert, new FullTextIndexEventListener()); c.SetListener(ListenerType.PostDelete, new FullTextIndexEventListener()); And here is the only place i query the index: var fullTextSession = NHibernate.Search.Search.CreateFullTextSession(this.unitOfWork.Session); var fullTextQuery = fullTextSession.CreateFullTextQuery(query, typeof (Person)); fullTextQuery.SetMaxResults(100); return fullTextQuery.List<Person>(); Whats going on? What am i doing wrong? Thanks

    Read the article

  • Avoiding Service Locator with AutoFac 2

    - by Page Brooks
    I'm building an application which uses AutoFac 2 for DI. I've been reading that using a static IoCHelper (Service Locator) should be avoided. IoCHelper.cs public static class IoCHelper { private static AutofacDependencyResolver _resolver; public static void InitializeWith(AutofacDependencyResolver resolver) { _resolver = resolver; } public static T Resolve<T>() { return _resolver.Resolve<T>(); } } From answers to a previous question, I found a way to help reduce the need for using my IoCHelper in my UnitOfWork through the use of Auto-generated Factories. Continuing down this path, I'm curious if I can completely eliminate my IoCHelper. Here is the scenario: I have a static Settings class that serves as a wrapper around my configuration implementation. Since the Settings class is a dependency to a majority of my other classes, the wrapper keeps me from having to inject the settings class all over my application. Settings.cs public static class Settings { public static IAppSettings AppSettings { get { return IoCHelper.Resolve<IAppSettings>(); } } } public interface IAppSettings { string Setting1 { get; } string Setting2 { get; } } public class AppSettings : IAppSettings { public string Setting1 { get { return GetSettings().AppSettings["setting1"]; } } public string Setting2 { get { return GetSettings().AppSettings["setting2"]; } } protected static IConfigurationSettings GetSettings() { return IoCHelper.Resolve<IConfigurationSettings>(); } } Is there a way to handle this without using a service locator and without having to resort to injecting AppSettings into each and every class? Listed below are the 3 areas in which I keep leaning on ServiceLocator instead of constructor injection: AppSettings Logging Caching

    Read the article

  • Understanding Domain Driven Design

    - by Nihilist
    Hi I have been trying to understand DDD for few weeks now. Its very confusing. I dont understand how I organise my projects. I have lot of questions on UnitOfWork, Repository, Associations and the list goes on... Lets take a simple example. Album and Tracks. Album: AlbumId, Name, ListOf Tracks Tracks: TrackId, Name Question1: Should i expose Tracks as a IList/IEnumerabe property on Album ? If that how do i add an album ? OR should i expose a ReadOnlyCollection of Tracks and expose a AddTrack method? Question2: How do i load Tracks for Album [assuming lazy loading]? should the getter check for null and then use a repository to load the tracks if need be? Question3: How do we organise the assemblies. Like what does each assembly have? Model.dll - does it only have the domain entities? Where do the repositories go? Interfaces and implementations both. Can i define IAlbumRepository in Model.dll? Infrastructure.dll : what shold this have? Question4: Where is unit of work defined? How do repository and unit of work communicate? [ or should they ] for example. if i need to add multiple tracks to album, again should this be defined as AddTrack on Album OR should there a method in the repository? Regardless of where the method is, how do I implement unit of work here? Question5: Should the UI use Infrastructure..dll or should there be ServiceLayer? Do my quesitons make sense? Regards

    Read the article

  • Generic <T> how cast ?

    - by Kris-I
    Hi, I have a "Product" base class, some other classes "ProductBookDetail","ProductDVDDetail" inherit from this class. I use a ProductService class to make operation on these classes. But, I have to do some check depending of the type (ISBN for Book, languages for DVD). I'd like to know the best way to cast "productDetail" value, I receive in SaveOrupdate. I tried GetType() and cast with (ProductBookDetail)productDetail but that's not work. Thanks, var productDetail = new ProductDetailBook() { .... }; var service = IoC.Resolve<IProductServiceGeneric<ProductDetailBook>>(); service.SaveOrUpdate(productDetail); var productDetail = new ProductDetailDVD() { .... }; var service = IoC.Resolve<IProductServiceGeneric<ProductDetailDVD>>(); service.SaveOrUpdate(productDetail); public class ProductServiceGeneric<T> : IProductServiceGeneric<T> { private readonly ISession _session; private readonly IProductRepoGeneric<T> _repo; public ProductServiceGeneric() { _session = UnitOfWork.CurrentSession; _repo = IoC.Resolve<IProductRepoGeneric<T>>(); } public void SaveOrUpdate(T productDetail) { using (ITransaction tx = _session.BeginTransaction()) { //here i'd like ot know the type and access properties depending of the class _repo.SaveOrUpdate(productDetail); tx.Commit(); } } }

    Read the article

  • Handling Denormalized Schema with Eclipselink

    - by iamrohitbanga
    Hello All I have a denormalized table containing employee information. The fields are employee id, name and department name. The primary key is a composite one consisting of all three fields. An employee can belong to multiple departments. I want to read/write the objects in the table using the Eclipselink Dynamic Persistence API (which is infact a wrapper on top of JPA descriptors etc.). Example Data: 1 e1 dep1 2 e1 dep2 3 e2 dep1 4 e2 dep3 5 e3 dep1 5 e3 dep2 5 e3 dep3 A normal ReadAllQuery (select query) on the table returns a DynamicEntity corresponding to each row in the table. However I want to club all entities based on the emp id and return all the departments he belongs to as a list. I can merge the entities after retrieving them but if I can use some Eclipselink feature out of the box then it would be better. One way to do the read is the following: I create two dynamic types corresponding to employee: Having id,name as the primary key Having id, department as the primary key, I create a OneToManyMapping from the first type to the second one. Then when I query the first type it does return the departments to which employee belongs as a list of DynamicEntity of the second type. This satisfies the read scenario. Is there a better way of doing this? Is this inherently supported by Eclipselink or JPA? I cannot get the same dynamic type configuration working for the write scenario. This is because when I write the changes using the writeObject method of UnitOfWork, it generates insert queries which enter the following entries in the table id name department 102 emp_102 102 st 102 dep_102 102 dep_102 102 dep_102 instead of: id name department 102 emp_102 st 102 emp_102 dep_102 102 emp_102 dep_102 102 emp_102 dep_102 Is there any way I can get write to work with this schema using eclipselink? I want to avoid doing the heavy lifting of merging the rows for such a denormalized schema or generating each row before doing a write. Is there no clean way of doing this using Eclipselink or JPA? Thanks in Advance.

    Read the article

  • Databound Label text displays old data upon save. Re-open record and data is correct?

    - by Mike Hestness
    I have a windows forms application. I have a main form and I have a button on this form to set a "Qualified" date/time stamp. I have a Databound label control that I set the value when the user clicks the button. This date/time stamp is working as far as displaying but when you click the save button it either shows blank or the previous date/time. If you then then close the record and re-open it the new date/time value is displayed so the data is getting to the database it's just not persisting in the dataset as new data?? Not sure why the databinding isn't refreshing the value. I have noticed this behavior even if I use a textbox, same thing if I do it programatically. If I manually type in a value it persists?? Here is the code I'm using in the click event of my button: string result = string.Empty; string jobOrderID = UnitOfWork.MasterDSBS.MJOBO[0].JC_IDNO.ToString(); string timeNow = DateTime.Now.ToString(); //Call Web service to make the update RadServices.Service1 rsWeb = new RadServices.Service1(); result = rsWeb.SetQualifiedDate(timeNow, jobOrderID ); //Changed the qualified label text. _btnQualify.Text = "Qualified"; rlQualifiedDate.Text = timeNow;

    Read the article

  • Problem updating through LINQtoSQL in MVC application using StructureMap, Repository Pattern and UoW

    - by matt
    I have an ASP MVC application using LINQ to SQL for data access. I am trying to use the Repository and Unit of Work patterns, with a service layer consuming the repositories and unit of work. I am experiencing a problem when attempting to perform updates on a particular repository. My application architecture is as follows: My service class: public class MyService { private IRepositoryA _RepositoryA; private IRepositoryB _RepositoryB; private IUnitOfWork _unitOfWork; public MyService(IRepositoryA ARepositoryA, IRepositoryB ARepositoryB, IUnitOfWork AUnitOfWork) { _unitOfWork = AUnitOfWork; _RepositoryA = ARepositoryA; _RepositoryB = ARepositoryB; } public PerformActionOnObject(Guid AID) { MyObject obj = _RepositoryA.GetRecords() .WithID(AID); obj.SomeProperty = "Changed to new value"; _RepositoryA.UpdateRecord(obj); _unitOfWork.Save(); } } Repository interface: public interface IRepositoryA { IQueryable<MyObject> GetRecords(); UpdateRecord(MyObject obj); } Repository LINQtoSQL implementation: public class LINQtoSQLRepositoryA : IRepositoryA { private MyDataContext _DBContext; public LINQtoSQLRepositoryA(IUnitOfWork AUnitOfWork) { _DBConext = AUnitOfWork as MyDataContext; } public IQueryable<MyObject> GetRecords() { return from records in _DBContext.MyTable select new MyObject { ID = records.ID, SomeProperty = records.SomeProperty } } public bool UpdateRecord(MyObject AObj) { MyTableRecord record = (from u in _DB.MyTable where u.ID == AObj.ID select u).SingleOrDefault(); if (record == null) { return false; } record.SomeProperty = AObj.SomePropery; return true; } } Unit of work interface: public interface IUnitOfWork { void Save(); } Unit of work implemented in data context extension. public partial class MyDataContext : DataContext, IUnitOfWork { public void Save() { SubmitChanges(); } } StructureMap registry: public class DataServiceRegistry : Registry { public DataServiceRegistry() { // Unit of work For<IUnitOfWork>() .HttpContextScoped() .TheDefault.Is.ConstructedBy(() => new MyDataContext()); // RepositoryA For<IRepositoryA>() .Singleton() .Use<LINQtoSQLRepositoryA>(); // RepositoryB For<IRepositoryB>() .Singleton() .Use<LINQtoSQLRepositoryB>(); } } My problem is that when I call PerformActionOnObject on my service object, the update never fires any SQL. I think this is because the datacontext in the UnitofWork object is different to the one in RepositoryA where the data is changed. So when the service calls Save() on it's IUnitOfWork, the underlying datacontext does not have any updated data so no update SQL is fired. Is there something I've done wrong in the StrutureMap registry setup? Or is there a more fundamental problem with the design? Many thanks.

    Read the article

< Previous Page | 1 2 3  | Next Page >