Search Results

Search found 4689 results on 188 pages for 'weak references'.

Page 36/188 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • How can I configure a Factory with the possible providers?

    - by Jonathas Costa
    I have three assemblies: "Framework.DataAccess", "Framework.DataAccess.NHibernateProvider" and "Company.DataAccess". Inside the assembly "Framework.DataAccess", I have my factory (with the wrong implementation of discovery): public class DaoFactory { private static readonly object locker = new object(); private static IWindsorContainer _daoContainer; protected static IWindsorContainer DaoContainer { get { if (_daoContainer == null) { lock (locker) { if (_daoContainer != null) return _daoContainer; _daoContainer = new WindsorContainer(new XmlInterpreter()); // THIS IS WRONG! THIS ASSEMBLY CANNOT KNOW ABOUT SPECIALIZATIONS! _daoContainer.Register( AllTypes.FromAssemblyNamed("Company.DataAccess") .BasedOn(typeof(IReadDao<>)).WithService.FromInterface(), AllTypes.FromAssemblyNamed("Framework.DataAccess.NHibernateProvider") .BasedOn(typeof(IReadDao<>)).WithService.Base()); } } return _daoContainer; } } public static T Create<T>() where T : IDao { return DaoContainer.Resolve<T>(); } } This assembly also defines the base interface for data access IReadDao: public interface IReadDao<T> { IEnumerable<T> GetAll(); } I want to keep this assembly generic and with no references. This is my base data access assembly. Then I have the NHibernate provider's assembly, which implements the above IReadDao using NHibernate's approach. This assembly references the "Framework.DataAccess" assembly. public class NHibernateDao<T> : IReadDao<T> { public NHibernateDao() { } public virtual IEnumerable<T> GetAll() { throw new NotImplementedException(); } } At last, I have the "Company.DataAccess" assembly, which can override the default implementation of NHibernate provider and references both previously seen assemblies. public interface IProductDao : IReadDao<Product> { Product GetByName(string name); } public class ProductDao : NHibernateDao<Product>, IProductDao { public override IEnumerable<Product> GetAll() { throw new NotImplementedException("new one!"); } public Product GetByName(string name) { throw new NotImplementedException(); } } I want to be able to write... IRead<Product> dao = DaoFactory.Create<IRead<Product>>(); ... and then get the ProductDao implementation. But I can't hold inside my base data access any reference to specific assemblies! My initial idea was to read that from a xml config file. So, my question is: How can I externally configure this factory to use a specific provider as my default implementation and my client implementation?

    Read the article

  • T-SQL foreign key check constraint

    - by PaN1C_Showt1Me
    When you create a foreign key constraint in a table and you create the script in MS SQL Management Studio, it looks like this. ALTER TABLE T1 WITH CHECK ADD CONSTRAINT FK_T1 FOREIGN KEY(project_id) REFERENCES T2 (project_id) GO ALTER TABLE T1 CHECK CONSTRAINT FK_T1 GO What I don't understand is what purpose has the second alter with check constraint. Isn't creating the FK constraint enough? Do you have to add the check constraint to assure reference integrity ? Another question: how would it look like then when you'd write it directly in the column definition? CREATE TABLE T1 ( my_column INT NOT NULL CONSTRAINT FK_T1 REFERENCES T2(my_column) ) Isn't this enough?

    Read the article

  • Why is django admin not accepting Nullable foreign keys?

    - by p.g.l.hall
    Here is a simplified version of one of my models: class ImportRule(models.Model): feed = models.ForeignKey(Feed) name = models.CharField(max_length=255) feed_provider_category = models.ForeignKey(FeedProviderCategory, null=True) target_subcategories = models.ManyToManyField(Subcategory) This class manages a rule for importing a list of items from a feed into the database. The admin system won't let me add an ImportRule without selecting a feed_provider_category despite it being declared in the model as nullable. The database (SQLite at the moment) even checks out ok: >>> .schema ... CREATE TABLE "someapp_importrule" ( "id" integer NOT NULL PRIMARY KEY, "feed_id" integer NOT NULL REFERENCES "someapp_feed" ("id"), "name" varchar(255) NOT NULL, "feed_provider_category_id" integer REFERENCES "someapp_feedprovidercategory" ("id"), ); ... I can create the object in the python shell easily enough: f = Feed.objects.get(pk=1) i = ImportRule(name='test', feed=f) i.save() ...but the admin system won't let me edit it, of course. How can I get the admin to let me edit/create objects without specifying that foreign key?

    Read the article

  • CodeRush Tricks of the Trade

    - by dr. evil
    I was using CodeRush quite while ago and now I'm planning to use it again. I've install the trial but I forgot all cool features except Alt + Home (drop a marker). And when you don't know some cool tricks it's really like burning money (since it's not cheap for personal use) What do you like about it? What are your best features? My best feature is marker: Alt + Home (and use escape to go back) P.S Dear Devxpress, if you think I helped you by asking this question I can accept some donations, a free license of CodeRush would be nice! Currently What I like most ps/pi etc. shortcut to create properties cc to create constructors pressing tab to navigate between the references F12 to find references in new cool window Ctrl + Shift + . for recent files Ctrl + Shift + Q for jumping to any function / class fe/fi for "for loops"

    Read the article

  • Reference non-GAC version of DLL in Visual Studio 2010

    - by Eric J.
    This is similar to Add Non-GAC reference to project but the solutions presented there don't seem to help. I have a WinForms UI Library (Krypton from ComponentFactory) installed in the GAC. There's a bug I want to track down in that library, so I added the source code to my solution, removed the old references from my WinForms project to Krypton DLLs, added them back as a project references, ensured Copy Local is set to true, double-checked that the path (on reference properties tab) points to my local project, and... ...the GAC version is still being used while debugging. I cannot set a breakpoint in the Krypton source, Debugger.Break() or other code changes to not execute, and when I start the Visual Studio 2010 debugger, I see a Loading from ... GAC_MISL message relating to the Krypton DLLs flash by in the VS 2010 status bar. The DLLs are not copied to the WinForm's Debug folder. How can I reference the "project" version of the files while debugging while leaving them registered in the GAC?

    Read the article

  • How to convert this foreach loop into Linq code?

    - by a-galkin
    I am new one with Linq and I would like to modify my old c# code to use Linq. The idea of this code to select all tables where it's not set and reference’s field PrimaryTable equal "myTable" foreach (Table table in dbServer.Tables) { if (!table.IsSet) { foreach (Reference refer in table.References) { if (refer.PrimaryTable == "myTable") { tables.Add(table); } } } } After digging in internet I have got this code var q = from table in dbServer.Tables let refers = from refer in table.References where refer.PrimaryTable == "myTable" select refer.ForeignTable where refers.Contains(table.Name) select table; But it does not work at all and I need your help to make it works. Thanks in advance.

    Read the article

  • "Reference required" error when referencing NServiceBus assembly from another project

    - by cwegrzyn
    We are trying to write an application that uses the NServiceBus library in a VB.NET environment. We've been stymied by errors similar to the following: Reference required to assembly 'NServiceBus, Version=2.0.0.1071, Culture=neutral, PublicKeyToken=9fc386479f8a226c' containing the implemented interface 'NServiceBus.IMessageHandler`1'. Add one to your project. Our project already includes references to NServiceBus.dll and NServiceBus.Core.dll from the same NServiceBus 2.0 RC2 distribution. Steps to reproduce: Create a new VB Class Library Project (.NET 3.5) Add NServiceBus.dll and NServiceBus.Core.dll as References. Put the following code in Class1.vb: Imports NServiceBus.Sagas.Impl Class Test Public Function Foo() As SagaMessageHandler Return Nothing End Function End Class You should now see the compiler error mentioned above. An identical project written in C# has no compile errors. Any ideas about how to solve this problem? (And, yes, my preferred solution is switching to C#, but no, that's not an acceptable one at the moment.)

    Read the article

  • How to pass interface type/GUID reference to an automation method in Delphi

    - by Alan Clark
    In Delphi you can pass class references around to compare the types of objects, and to instantiate them. Can you do the same with interface references being passed to a COM automation server? For example, you can define a method taking a GUID parameter using the type library editor: function ChildNodesOfType(NodeType: TGUID): IMBNode; safecall; In this function I would like to return automation types that support the interface specified by NodeType, e.g. if Supports(SomeNode, NodeType) then result := SomeNode; But the Supports call always fails, I tried passing in the Guids defined in the type library but none of the different types (Ixxx, Class_xxxx, IId_Ixxxx) seem to work.

    Read the article

  • In the following implementation of static_strlen, why are the & and parentheses around str necessary

    - by Ben
    If I change the type to const char str[Len], I get the following error: error: no matching function for call to ‘static_strlen(const char [5])’ Am I correct that static_strlen expects an array of const char references? My understanding is that arrays are passed as pointers anyway, so what need is there for the elements to be references? Or is that interpretation completely off-the-mark? #include <iostream> template <size_t Len> size_t static_strlen(const char (&str)[Len]) { return Len - 1; } int main() { std::cout << static_strlen("oyez") << std::endl; return 0; }

    Read the article

  • How to perform duplicate key validation using entlib (or DataAnnotations), MVC, and Repository pattern

    - by olivehour
    I have a set of ASP.NET 4 projects that culminate in an MVC (3 RC2) app. The solution uses Unity and EntLib Validation for cross-cutting dependency injection and validation. Both are working great for injecting repository and service layer implementations. However, I can't figure out how to do duplicate key validation. For example, when a user registers, we want to make sure they don't pick a UserID that someone else is already using. For this type of validation, the validating object must have a repository reference... or some other way to get an IQueryable / IEnumerable reference to check against other rows already in the DB. What I have is a UserMetadata class that has all of the property setters and getters for a user, along with all of the appropriate DataAnnotations and EntLib Validation attributes. There is also a UserEntity class implemented using EF4 POCO Entity Generator templates. The UserEntity depends on UserMetadata, because it has a MetadataTypeAttribute. I also have a UserViewModel class that has the same exact MetadataType attribute. This way, I can apply the same validation rules, via attributes, to both the entity and viewmodel. There are no concrete references to the Repository classes whatsoever. All repositories are injected using Unity. There is also a service layer that gets dependency injection. In the MVC project, service layer implementation classes are injected into the Controller classes (the controller classes only contain service layer interface references). Unity then injects the Repository implementations into the service layer classes (service classes also only contain interface references). I've experimented with the DataAnnotations CustomValidationAttribute in the metadata class. The problem with this is the validation method must be static, and the method cannot instantiate a repository implementation directly. My repository interface is IRepository, and I have only one single repository implementation class defined as EntityRepository for all domain objects. To instantiate a repository explicitly I would need to say new EntityRepository(), which would result in a circular dependency graph: UserMetadata [depends on] DuplicateUserIDValidator [depends on] UserEntity [depends on] UserMetadata. I've also tried creating a custom EntLib Validator along with a custom validation attribute. Here I don't have the same problem with a static method. I think I could get this to work if I could just figure out how to make Unity inject my EntityRepository into the validator class... which I can't. Right now, all of the validation code is in my Metadata class library, since that's where the custom validation attribute would go. Any ideas on how to perform validations that need to check against the current repository state? Can Unity be used to inject a dependency into a lower-layer class library?

    Read the article

  • automatic push to CDN deployment strategy

    - by imanc
    Does anyone have ideas for a strategy to push content to a CDN upon deployment? The key issue I'm facing is that we have a site that is available in various contexts: local development, development server, staging, then finally live. The liver version of the site needs to load assets from a domain, which will be pointed to a CDN: assets.domain.com. However, we will have numerous references to the assets pointing to a relative folder, e.g. /images/ in css, possibly in js, and in HTML & source. Our new site will use capistrano for deployment and it may be that we can hook in another build tool (apache ant?) or some custom script to search / replace paths. I am wondering if anyone has had to deal with this issue before and what solutions you put in place to automate managing the CDN in terms of pushing content up to the CDN and managing html & css references to assets in the CDN. Thanks Imanc

    Read the article

  • Hibernate doesn't generate cascade

    - by Shervin
    Hi. I have a set hibernate.hbm2ddl.auto to create so that Hibernate creates the tables in mysql for me. However, it doesn't seem that hibernate correctly adds Cascade on the references in the table. It does however work when I for instance delete a row, and I have a delete cascade as hibernate annotation. So I guess that means that Hibernate reads the annoation on runtime, and perform cascading manually? Is that normal behavior? For instance: @Entity class Report { @OneToOne(cascade = CascadeType.ALL) public File getPdf() { return pdf; } } Here I have set cascade to ALL. However, when running show create table Report Report | CREATE TABLE `Report` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `pdf_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK91B14154FDE6543A` (`pdf_id`), CONSTRAINT `FK91B14154FDE6543A` FOREIGN KEY (`pdf_id`) REFERENCES `File` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 | It doesn't say anything about cascading other then the foreign key. In my opinion, it should have added the ON DELETE CASCADE ON DELETE UPDATE

    Read the article

  • Service Contracts with Message causes duplicate proxy classes

    - by jaklucky
    Hi, I have a service contract with Message as shown below. [OperationContract] Message MyMethodWithMessage(Message myMsgParam); Everything works fine. I could host my services. But when I try to create proxies through "Add Service References", I am getting the duplicate proxy classes. If I take out the above OperationContract and re run my services and try to create proxies, then "Add Service References" does not provide duplicate proxies. I am really confused about this!!! Any help is greatly appreciated... Thank you, Suresh

    Read the article

  • Cannot create instance of 'Ribbon'

    - by user354433
    I'm having trouble using the Ribbon control from the Office 2007 RibbonControlsLibrary.dll. It works for most people but not for me. The fault I get is: Cannot create instance of 'Ribbon' defined in assembly 'RibbonControlsLibrary, Version=3.5.31016.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Exception has been thrown by the target of an invocation The problem is probably not with the code since it works for other people. Its the Ribbon class thats causing the problem. If I remove any references to the Ribbon class but keep the references to RibbonWindow I don't get any exceptions. Any help appreciated

    Read the article

  • Change page layout in the middle of a LaTeX document

    - by David
    I'm looking for a way to change some page layout dimensions in the middle of a LaTeX document. The reason is, I'd like to have smaller margins and longer lines in the "References" section of my report document (basically because short lines aren't so important there and I can save space). In my preamble I have (works fine): \setlength\textwidth{130mm} \setlength\oddsidemargin{14.6mm} In the document I simply try to re-set them at the right point but they're ignored. ... last paragraph ends here. \newpage \setlength\textwidth{150mm} % +20mm text width \setlength\oddsidemargin{13.6mm} % -10mm left margin (so it stays centered) References ... The geometry package is useful but only for global adjustments in the preamble, so I can't use it here. Is it not possible to change the page layout at some point in the document?

    Read the article

  • ASP.Net MVC 2 / EF 4 Reference Issue

    - by Eric J.
    My ASP.Net MVC 2 project references a Domain project where POCO business objects are defined and a Data project where EF 4 POCO persistence is implemented. Things were running well until I had a little fussiness with my version control provider (rollback to previous version left me with merge conflicts). Now, upon launching the MVC 2 project, I get a runtime error: The type 'System.Data.Objects.DataClasses.IEntityWithKey' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. However, every project references System.Data.Entity (same version). If I remove the reference to System.Data.Entity from the MVC 2 project, I get the same message as a compile-time error. I'm pretty sure something got messed up when I had the version control issue, but really not sure where to look for this one.

    Read the article

  • git global config issue

    - by Andrew Bullock
    Somehow, my global git (msysgit) settings for user.name and user.email (and god knows what else) are set to a recent ex-colleague's details. When I try and change them i get could not commit to u://.gitconfig If I try and create u://.gitconfig through git bash then i get permission denied. C:\Users\<My Username>\ contains no references to git. I've tried uninstalling, searching the registry and my file system for all references to git and I can't find any (windows file search is crap though). What the hell is going on? Why even after reinstalling are this guys details still the global settings??? Thanks

    Read the article

  • JPA One to Many using JoinTable Error

    - by user553015
    I am trying to model 1:N (Person & Address) relationship using a junction table (Person_Address). 1.Person (personId PK) 2.Address (addressId PK) 3.PersonAddress ( personId, addressId composite PK, personId FK references Person, addressid FK references Address ) @Entity public class Person { @OneToMany @JoinTable( name="PersonAddress", joinColumns = @JoinColumn( name="personId"), inverseJoinColumns = @JoinColumn( name="addressId") ) public Set<Address> getAddresses() {...} ... } I encounter following error. Not able to find any solution. Caused by: org.hibernate.MappingException: Could not determine type for: com.realestate.details.Address, at table: Person, for columns: [org.hibernate.mapping.Column(address)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) at org.hibernate.mapping.Property.isValid(Property.java:185) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440) at org.hibernate.mapping.RootClass.validate(RootClass.java:192) at org.hibernate.cfg.Configuration.validate(Configuration.java:1108) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)

    Read the article

  • foreign key constraints on primary key columns - issues ?

    - by zzzeek
    What are the pros/cons from a performance/indexing/data management perspective of creating a one-to-one relationship between tables using the primary key on the child as foreign key, versus a pure surrogate primary key on the child? The first approach seems to reduce redundancy and nicely constrains the one-to-one implicitly, while the second approach seems to be favored by DBAs, even though it creates a second index: create table parent ( id integer primary key, data varchar(50) ) create table child ( id integer primary key references parent(id), data varchar(50) ) pure surrogate key: create table parent ( id integer primary key, data varchar(50) ) create table child ( id integer primary key, parent_id integer unique references parent(id), data varchar(50) ) the platforms of interest here are Postgresql, Microsoft SQL Server.

    Read the article

  • How Can I Reference Multiple Primary Keys For A Vector Type Primary Key

    - by AndreiC
    Hi, I have the following scenario: a table of projects and a table of persons, working on one or serveral projects. Also, I have a project id column (of type int), in the first table, which is a primary key there and I have a vector of project ids, as a column of type int, in my second table (persons), that references primary keys from the first table. What is the correct syntax for referencing multiple primary keys, from a vector foreign key. This is the way I am trying to create the table, but I am not sure what to place at the indicated line: CREATE TABLE Persons( Person_Id int, ..., ProjectsList int[], FOREIGN KEY (ProjectsList) REFERENCES Projects(Project_id) -- not sure what how to define the link here ); I hope my explanations are not over-complicated. Thank you in advance for helping!

    Read the article

  • How to dynamically modify NHibernate load queries at runtime? EventListeners? Interceptors?

    - by snicker
    I need to modify the query used to load many-to-one references in my model. Specifically, I need to be able to further filter this data. Unfortunately, NH will not allow me to filter many-to-one relationships using the built in filtering system (?). I could just be doing something incorrect. Is there a hook where I can manually and dynamically modify the query used to load the data? Or an alternative to filters that will allow me to specify parameters? Background: I am working with a database that is using a form of revision control, with each entity having a natural ID PK, an EntityId, a RevisionValidTo and RevisionValidFrom field. There may be many rows using the same EntityId, which is the reference for other tables to join on, but the Revision ranges are mutually exclusive. Thus, the relationship is only many-to-one IIF the filter is applied. However, NH offers no way to specify a filter on many-to-one references (they do for collections...)

    Read the article

  • Creating a foreign key in MySQL produces error:

    - by SnOrfus
    I'm trying to create a foreign key on a table in MySQL and I'm getting a strange error that there seems to be little info about in any of my searches. I'm creating the key with this (emitted from mysql workbench 5.2): ALTER TABLE `db`.`appointment` ADD CONSTRAINT `FK_appointment_CancellationID` FOREIGN KEY (`CancellationID` ) REFERENCES `db`.`appointment_cancellation` (`ID` ) ON DELETE NO ACTION ON UPDATE NO ACTION , ADD INDEX `FK_appointment_CancellationID` (`CancellationID` ASC) ; at which point I get the error: ERROR 1452: Cannot add or update a child row: a foreign key constraint fails (alarmtekcore., CONSTRAINT FK_lead_appointment_CancellationID FOREIGN KEY (CancellationID) REFERENCES lead_appointment_cancellation (`) I've checked here but there's no data in the table.

    Read the article

  • How does Hibernate detect dirty state of an entity object?

    - by ???'Lenik
    Is it using some kind of byte codes modification to the original classes? Or, maybe Hibernate get the dirty state by compare the given object with previously persisted version? I'm having a problem with hashCode() and equals() methods for complicated objects. I feel it would be very slow to compute hash code if the object has collection members, and cyclic references are also a problem. If Hibernate won't use hashCode()/equals() to check the dirty state, I guess I should not use equals()/hashCode() for the entity object (not value object), but I'm also afraid if the same operator (==) is not enough. So, the questions are: How does Hibernate know if a property of an object is changed? Do you suggest to override the hashCode()/equals() methods for complicated objects? What if they contains cyclic references? And, also, Would hashCode()/equals() with only the id field be enough?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >