Search Results

Search found 399 results on 16 pages for 'castle windsor'.

Page 7/16 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How do I merge a transient entity with a session using Castle ActiveRecordMediator?

    - by Daniel T.
    I have a Store and a Product entity: public class Store { public Guid Id { get; set; } public int Version { get; set; } public ISet<Product> Products { get; set; } } public class Product { public Guid Id { get; set; } public int Version { get; set; } public Store ParentStore { get; set; } public string Name { get; set; } } In other words, I have a Store that can contain multiple Products in a bidirectional one-to-many relationship. I'm sending data back and forth between a web browser and a web service. The following steps emulates the communication between the two, using session-per-request. I first save a new instance of a Store: using (new SessionScope()) { // this is data from the browser var store = new Store { Id = Guid.Empty }; ActiveRecordMediator.SaveAndFlush(store); } Then I grab the store out of the DB, add a new product to it, and then save it: using (new SessionScope()) { // this is data from the browser var product = new Product { Id = Guid.Empty, Name = "Apples" }); var store = ActiveRecordLinq.AsQueryable<Store>().First(); store.Products.Add(product); ActiveRecordMediator.SaveAndFlush(store); } Up to this point, everything works well. Now I want to update the Product I just saved: using (new SessionScope()) { // data from browser var product = new Product { Id = Guid.Empty, Version = 1, Name = "Grapes" }; var store = ActiveRecordLinq.AsQueryable<Store>().First(); store.Products.Add(product); // throws exception on this call ActiveRecordMediator.SaveAndFlush(store); } When I try to update the product, I get the following exception: a different object with the same identifier value was already associated with the session: 00000000-0000-0000-0000-000000000000, of entity:Product" As I understand it, the problem is that when I get the Store out of the database, it also gets the Product that's associated with it. Both entities are persistent. Then I tried to save a transient Product (the one that has the updated info from the browser) that has the same ID as the one that's already associated with the session, and an exception is thrown. However, I don't know how to get around this problem. If I could get access to a NHibernate.ISession, I could call ISession.Merge() on it, but it doesn't look like ActiveRecordMediator has anything similar (SaveCopy threw the same exception). Does anyone know the solution? Any help would be greatly appreciated!

    Read the article

  • Can Castle Monorail and ASP.NET MVC coexist in the same project?

    - by Matthew
    I have a large Monorail project that we have decided we are going to move over to ASP.NET MVC. Most of the underlying system will likely be reusable, but the Controllers will of course have to be rewritten, and proabably at least some of the views. It strikes me that a low risk avenue for this is gradually convert well defined sections of the system to MVC, and perhaps as MVCContrib Portable Areas. Does anyone know if there are any non-obvious gotchas that I am likely to run into with this approach? Thanks for your input, Matthew

    Read the article

  • What are the benefits of Castle Monorail 3 over ASP.Net MVC?

    - by yorch
    I have been using Castle Monorail for some years now with great success, although I haven't bothered to update the version I'm using (2 or 3 year old). Now I'm making a decision on go to ASP.Net MVC 3 or update to the latest Castle version. I have been looking documentation on the newest version of Castle projects (specially Monorail), but there is really little or no info around (I may be wrong). Does someone knows what are the benefits/new features of version 3 over ASP.Net MVC3? Thanks!

    Read the article

  • Verify a X.509 certificate with Java ME and Bouncy Castle

    - by Dino
    Hi, Can anybody point me to an example of verifying a X.509 certificate with Bouncy Castle under Java ME? I can see how to easily do this in Java SE code with java.security.cert.Certificate.verify(), but I could not find an equivalent method in the lightweight BC API. Thanks in advance! Cheers Dino

    Read the article

  • Castle ActiveRecord Table name conflict

    - by Shane
    When you run into a reserved word like "User" in NHibernate you would just put single quotes around the offending text and nHibernate will surround the text with square brackets for querying. My question is how do you do the same thing using Castle.ActiveRecord?

    Read the article

  • Wcf Facility Metadata publishing for this service is currently disabled.

    - by cvista
    Hey I'm trying to connect to my Wcf service which is configured using castles wcf facility. When I go to the service in a browser i get: Metadata publishing for this service is currently disabled. Which lists a load of instructions which i cant do because the configuration isnt in the web.config. when I try to connect using VS/add service reference i get: The HTML document does not contain Web service discovery information. Metadata contains a reference that cannot be resolved: 'http://s.ibzstar.com/userservices.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://s.ibzstar.com/userservices.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again. Anyone know what I need to do to get this working? The end client is an iPhone app written using Monotouch if that matters - so no castle windsor on the client side. cheers w:// Here's the Windsor.config from the service: <?xml version="1.0" encoding="utf-8" ?> <configuration> <components> <component id="eventServices" service="IbzStar.Domain.IEventServices, IbzStar.Domain" type="IbzStar.Domain.EventServices, IbzStar.Domain" lifestyle="transient"> </component> <component id="userServices" service="IbzStar.Domain.IUserServices, IbzStar.Domain" type="IbzStar.Domain.UserServices, IbzStar.Domain" lifestyle="transient"> </component> The Web.config section: <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> <services> </services> <behaviors> <serviceBehaviors> <behavior name="IbzStar.WebServices.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> My App_Start contains this: Container = new WindsorContainer(new XmlInterpreter(new ConfigResource())) .AddFacility<WcfFacility>() .Install(Configuration.FromXmlFile("Windsor.config")); As for the client config - I'm using the wizard to add the service.

    Read the article

  • Hooking into AppInitialize with WCF service

    - by Mark
    Hi, Im having issues with my WCF service. I need to do a windsor container injection pre application_start and noticed i can use the AppInitialise method. It works on visual studio debug but when I deploy to IIS the code does not get fired.. I initialized the class as follows public static class Class1 { public static void AppInitialize() { IWindsorContainer container; container = new WindsorContainer("windsor.xml"); container.AddFacility(); container.Resolve(); } } Is there any special task i need to do to get this to work on IIS. Im using version 6. Thanks!

    Read the article

  • WCF Integration Facility and Self-Hosted Services

    - by IanT8
    I'm self-hosting several services where I do this to register the service: host = new ServiceHost(typeof(MyService)); host.Open(); Behind the scenes, wcf instantiates my service via the default constructor. Is it possble to use the WCF Integration Facility of Castle Windsor to get WCF to call on Windsor to create the service when I am self-hosting? The example seems shows IIS hosted services where the 1st line of the MyService.svc file looks like: <%@ServiceHost language=c# Debug="true" Service="Microsoft.ServiceModel.Samples.CalculatorService" Factory=WindsorServiceHostFactory%> where presumably a factory is used by wcf to instantiate the service instance.

    Read the article

  • Does NInject work in medium trust hosting?

    - by Gabriel
    I'm doing shared hosting with GoDaddy and I developed a sample ASP.NET MVC app using Castle Windsor and unfortunately, it didn't work in a medium trust setting. Specifically, I got this error: "[SecurityException: That assembly does not allow partially trusted callers"... etc. GoDaddy is sadly not flexible in their trust policy. I'm not tied to Windsor and would like to try another one that will work under Medium Trust. I'd actually like to use NInject, but I've read people having mixed success. The only one I've read that works with no problem is Microsoft's Unity. My question is, does NInject work in medium trust? If not, what are my options?

    Read the article

  • Which IOC runs in medium trust

    - by Rippo
    Hi I am trying to get a website running with Mosso that has Castle Windsor as my IOC, however I am getting the following error. [SecurityException: That assembly does not allow partially trusted callers.] GoldMine.WindsorControllerFactory..ctor() in WindsorControllerFactory.cs:33 GoldMine.MvcApplication.Application_Start() in Global.asax.cs:70 My questions are Does Castle Windsor run under medium trust? Can I download the DLL's without having to recompile with nant? (as I don't have this set up and don't know nant at all) Or is there another IOC that I can use that I can download and works in Medium Trust? Thanks

    Read the article

  • Bouncy Castle, RSA : transforming keys into a String format

    - by Rami W.
    Hi, iam using RSA(Bouncy Castle API) in my c# porject. Igenerated the keypair with this method RsaKeyPairGenerator r = new RsaKeyPairGenerator(); r.Init(new KeyGenerationParameters(new SecureRandom(), 1024)); AsymmetricCipherKeyPair keys = r.GenerateKeyPair(); AsymmetricKeyParameter private_key = keys.Private; AsymmetricKeyParameter public_key = keys.Public; now i want to save them in txt file but the problem is that i can't convert them to a string format. i read in another post that keys must be serialized using PrivateKeyInfo k = PrivateKeyInfoFactory.CreatePrivateKeyInfo(private_key); byte[] serializedKey = k.ToAsn1Object().GetDerEncoded(); Is it the right way ? if yes, what should i do after this ? just convert them from byte[] to String ? thx for any help.

    Read the article

  • Constructor on type: "Namespace.type" not found.

    - by Nick
    Hello, I am using Castle.Windsor as an IOC. So I am trying to resolve a service type in the constructor of an HTTPHandler. I keep receiving this error, "Constructor on type: "Namespace.type" not found." My configuration has the following entries for service type: IDocumentDirectory <component id="restricted.content.directory" service="org.healthwise.foundations.services.content.IDocumentDirectory, org.healthwise.foundations.services" type="org.healthwise.foundations.services.content.RestrictedLocalizationDocumentDirectory, org.healthwise.foundations.services"> <parameters> <contentDirectory>${content.directory}</contentDirectory> <localizations> <array> <item>en-us</item> <item>es-us</item> </array> </localizations> </parameters> </component> <component id="content.directory" service="org.healthwise.foundations.services.content.IDocumentDirectory, org.healthwise.foundations.services" type="org.healthwise.foundations.services.web.client.WebServiceDocumentDirectory, org.healthwise.foundations.services.web.client"> <parameters> <webServiceURL>#{contentDirectoryWebsiteUrl}</webServiceURL> </parameters> </component> In my new handler the constructor looks like this: public HeartBeatHttpHandler(IDocumentDirectory contentDirectory) { _contentDirectory = contentDirectory; } I have never recieved this error using Castle.Windsor. Can someone explain? Thanks!

    Read the article

  • Is there any way to add references without recompiling in .NET?

    - by Jader Dias
    I am using a IoC Container (Castle Windsor) to instantiate classes accordingly to the configuration file. If I want to add classes from a new dll that didn't exist when I compiled the project, there is any way to do that without recompiling? Edit: As this project is a Service Host for WCF service, and the classes that I want to include after compilation are WCF Services I would like also to know if I can include endpoint information about new services without recompiling.

    Read the article

  • Windsore dependency

    - by jack
    I have a class with contructure like this public UserRepository(IBlockRepository blockRepos) { } and again, I have another class with the constructure function like this public BlockRepository(IUserRepository userRepo) { } this cause the Windsor error : Castle.MicroKernel.Handlers.HandlerException: Can't create component 'UserRepository' as it has dependencies to be satisfied. UserRepository is waiting for the following dependencies I don't know how to fix it , please help me. Many thanks

    Read the article

  • Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO)

    - by FryHard
    The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well! The problem comes about with Castle Activerecords support for asynchronous execution, well, more specifically the SessionScope that manages the session that objects belong to. Long story short, bad stuff happens! We are therefore looking for a way to easily convert (think automagically) from the Domain objects (who know that a DB exists and care) to the DTO object (who know nothing about the DB and care not for sessions, mapping attributes or all thing ORM). Does anyone have suggestions on doing this. For the start I am looking for a basic One to One mapping of object. Domain object Person will be mapped to say PersonDTO. I do not want to do this manually since it is a waste. Obviously reflection comes to mind, but I am hoping with some of the better IT knowledge floating around this site that "cooler" will be suggested. Oh, I am working in C#, the ORM objects as said before a mapped with Castle ActiveRecord. Example code: By @ajmastrean's request I have linked to an example that I have (badly) mocked together. The example has a capture form, capture form controller, domain objects, activerecord repository and an async helper. It is slightly big (3MB) because I included the ActiveRecored dll's needed to get it running. You will need to create a database called ActiveRecordAsync on your local machine or just change the .config file. Basic details of example: The Capture Form The capture form has a reference to the contoller private CompanyCaptureController MyController { get; set; } On initialise of the form it calls MyController.Load() private void InitForm () { MyController = new CompanyCaptureController(this); MyController.Load(); } This will return back to a method called LoadComplete() public void LoadCompleted (Company loadCompany) { _context.Post(delegate { CurrentItem = loadCompany; bindingSource.DataSource = CurrentItem; bindingSource.ResetCurrentItem(); //TOTO: This line will thow the exception since the session scope used to fetch loadCompany is now gone. grdEmployees.DataSource = loadCompany.Employees; }, null); } } this is where the "bad stuff" occurs, since we are using the child list of Company that is set as Lazy load. The Controller The controller has a Load method that was called from the form, it then calls the Asyc helper to asynchronously call the LoadCompany method and then return to the Capture form's LoadComplete method. public void Load () { new AsyncListLoad<Company>().BeginLoad(LoadCompany, Form.LoadCompleted); } The LoadCompany() method simply makes use of the Repository to find a know company. public Company LoadCompany() { return ActiveRecordRepository<Company>.Find(Setup.company.Identifier); } The rest of the example is rather generic, it has two domain classes which inherit from a base class, a setup file to instert some data and the repository to provide the ActiveRecordMediator abilities.

    Read the article

  • How to use Bouncy Castle lightweight API with AES and PBE

    - by Adrian
    I have a block of ciphertext that was created using the JCE algorithim "PBEWithSHA256And256BitAES-CBC-BC". The provider is BouncyCastle. What I'd like to do it decrypt this ciphertext using the BouncyCastle lightweight API. I don't want to use JCE because that requires installing the Unlimited Strength Jurisdiction Policy Files. Documentation seems to be thin on the ground when it comes to using BC with PBE and AES. Here's what I have so far. The decryption code runs without exception but returns rubbish. The encryption code, String password = "qwerty"; String plainText = "hello world"; byte[] salt = generateSalt(); byte[] cipherText = encrypt(plainText, password.toCharArray(), salt); private static byte[] generateSalt() throws NoSuchAlgorithmException { byte salt[] = new byte[8]; SecureRandom saltGen = SecureRandom.getInstance("SHA1PRNG"); saltGen.nextBytes(salt); return salt; } private static byte[] encrypt(String plainText, char[] password, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Security.addProvider(new BouncyCastleProvider()); PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 20); PBEKeySpec pbeKeySpec = new PBEKeySpec(password); SecretKeyFactory keyFac = SecretKeyFactory.getInstance("PBEWithSHA256And256BitAES-CBC-BC"); SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec); Cipher encryptionCipher = Cipher.getInstance("PBEWithSHA256And256BitAES-CBC-BC"); encryptionCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec); return encryptionCipher.doFinal(plainText.getBytes()); } The decryption code, byte[] decryptedText = decrypt(cipherText, password.getBytes(), salt); private static byte[] decrypt(byte[] cipherText, byte[] password, byte[] salt) throws DataLengthException, IllegalStateException, InvalidCipherTextException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { BlockCipher engine = new AESEngine(); CBCBlockCipher cipher = new CBCBlockCipher(engine); PKCS5S1ParametersGenerator keyGenerator = new PKCS5S1ParametersGenerator(new SHA256Digest()); keyGenerator.init(password, salt, 20); CipherParameters keyParams = keyGenerator.generateDerivedParameters(256); cipher.init(false, keyParams); byte[] decryptedBytes = new byte[cipherText.length]; int numBytesCopied = cipher.processBlock(cipherText, 0, decryptedBytes, 0); return decryptedBytes; }

    Read the article

  • use bouncy castle libraries to encrypt files using public key from digital certificate

    - by mike
    I got the public key from the certificate, keypair is a java.security.KeyPair object String public_key = keypair.getPublic().toString(); I want to send this to the via an http connection to a J2me application. I cannot find any documentation to convert the transmitted string to a Public key that can be used to encrypt Strings. I also want the J2me to verify signed strings from the server. I want to then send the encrypted strings back to the server.

    Read the article

  • Using a Dependency Injection Container in an enterprise solution with multiple different configurati

    - by KevinT
    Can anyone point me towards some good documentation / code examples on how best to manage the configuration of a DI container in a scenario where you need different configuations sets? We have a layered, distributed application that has multiple entry points (ie; a website, winforms app, office plugin etc). Depending on how you are using the solution (through a UI vs. an automated workflow for example), it needs to be configured slightly differently. We are using Windsor, and it's fluent configuration capabilities.

    Read the article

  • use bouncy castle to create public key on j2me

    - by mike
    I got the public key from the certificate, keypair is a java.security.KeyPair object String public_key = keypair.getPublic().toString(); I want to send this to the via an http connection to a J2me application. I cannot find any documentation to convert the transmitted string to a Public key that can be used to encrypt Strings. I also want the J2me to verify signed strings from the server. I want to then send the encrypted strings back to the server.

    Read the article

  • ASP.NET-MVC2 Preview 1: Are There Any Breaking Changes?

    - by Jim G.
    I was following Steven Sanderson's 'Pro ASP.NET MVC Framework' book. On page 132, in accordance with the author's recommendation, I downloaded the ASP.NET MVC Futures assembly, and added it to my MVC project. Then, without encouragement from the author, I downloaded, installed, and incorporated the ASP.NET MVC2 Preview 1 dlls into my project. Now, I can no longer load the website. That is, when I hit F5 in Visual Studio, I get this error. In retrospect, I think it was a really bad idea to assume that ASP.NET MVC2 Preview 1 would only be additive; but I'd like other people to weigh in. Has anyone noticed any breaking changes in ASP.NET MVC 2 Preview 1? Also - Has anyone noticed any changes that impact Castle Windsor? Also, please let me know if I should be mindful of IIS6 vs. IIS7 ramifications.

    Read the article

  • Are IoC containers about configuration files?

    - by Jader Dias
    Recently I developed a performance tester console application, with no UI, with the help of a IoC containter (Castle-Windsor-Microkernel). This library enabled me to let the user choose which test(s) to run, simply by changing the configuration file. Have I realized what IoC containers are about? I'm not sure. Even Joel said here on SO that IoC are difficult to understand. From my example, what do you conclude? Am I using IoC container for exactly what they were designed for? Or I am just using one of its secondary features?

    Read the article

  • Creating a Cerificate for Bouncy Castle Encryption

    - by Gordon
    I am trying to create a self-signed certificate to use for encrypting an email using bouncycaste. What would be the best way to generate a certificate? I have tried using openssl but I have had problems with certificate. Here is the code I am using to encrypt, I am using 3des. SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator(); gen.addKeyTransRecipient(x509Cert); // adds an X509Certificate MimeBodyPart encData = gen.generate(mimeBodyPart, SMIMEEnvelopedGenerator.DES_EDE3_CBC, "BC");

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >