Search Results

Search found 13782 results on 552 pages for 'compact framework'.

Page 13/552 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Entity Framework 4 - Delay Loading Expensive Fields

    - by JohnnyO
    I know this same question was asked for Entity Framework 1, but now that Entity Framework 4 has come out, and Microsoft claims that it provides all of the features of Linq to Sql + more, does Entity Framework now support lazy loading expensive properties? In Linq to Sql, this is extremely easy. There's a Delay Loaded option on any property (accessible through the Designer) that can simply be toggled on or off. Is there something similar in Entity Framework? Thanks

    Read the article

  • About Backward Compatibility of .NET Framework 4

    - by wuminqi
    We have an WPF Application build on .net framework 3.5. Some testers find if they uninstall .net framework 3.5, but install .net framework 4.0, our APP fails to launch itself. Dose this mean that .net framework 4.0 does not include all 3.5 libs, and users have to install .net 3.5 even though they have 4.0? I see here are some migration issues listed by Microsoft http://msdn.microsoft.com/en-us/library/ee941656.aspx#windows_presentation_foundation_wpf Are they all breaking changes so that the backward compatibility is ruined? Thanks

    Read the article

  • why do you like zend-framework?

    - by user1400
    hello all i stared to learn zf for some month , i like to know why other programmer have chocen zend-framework and why do you like zend-framework? What reasons made you choose Zend-framework? has zend-framework Satisfied you? thanks

    Read the article

  • installer hanging during .net 4.5 framework install

    - by Niall Collins
    I am having trouble installing Visual studio 2012 Premium Edition. I kick off the installer for it but it hangs when installing .net 4.5 framework. I have left it for hours but there is no progression in the progress bar. I have downloaded the .net 4.5 framework separately and tried to install that from msi but that also hangs similarly. The only way to kill it is by killing the process. Any ideas how I could resolve this issue, or what I need to do to trouble shoot it further? Any tips?

    Read the article

  • When to use shared libraries for a web framework?

    - by CamelBlues
    tl;dr: I've found myself hosting a bunch of sites running on the same web framework (symfony 1.4). Would it be helpful if I moved all of the shared library code into the same directory and shared it across the sites? more I see some advantages to this: Each site takes up less disk space Library updates (an unlikely scenario) can take place across all sites I also see some disadvantages, mostly in terms of a single point of failure and the inability to have sites using different versions of the framework. My real concern, though, is performance. I hypothesize that I will see a performance increase, since the PHP code will already be cached for all sites when they call the framework. Is this a correct hypothesis?

    Read the article

  • Visual Studio 2010 and .NET Framework 4 Training Kit April 2010 Release

    - by Harish Pavithran
    The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4 Visual Basic 10 F# Parallel Extensions Windows Communication Foundation Windows Workflow Windows Presentation Foundation ASP.NET 4 Windows 7 Entity Framework ADO.NET Data Services Managed Extensibility Framework Visual Studio Team System This version of the Training Kit works with Visual Studio 2010 and .NET Framework 4.  Here is the link enjoy www.microsoft.com/downloads/details.aspx

    Read the article

  • Can't uninstall/reinstall .NET Framework 3.5 with DISM

    - by andrew8666
    My net framework 3.5 is broken. Verification tool (http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx) says it's OK, but its not. Net framework 3.5 can't be just uninstalled/installed on Windows 7. But you can do this by add/remove windows features. For me this doesn't work, I receive thus (not very helpful) error message ... "An error occurred. not all of the updates were successfully uninstalled" I found DISM tool which does exactly same, but have log. And now: DISM /online /disable-feature /FeatureName:NetFx3 1603 error. And log: http://pastebin.com/4jBkEiT6 Any ideas how to do it?

    Read the article

  • What the best way to wire up Entity Framework database context (model) to ViewModel in MVVM WPF?

    - by hal9k2
    As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)? I am learning MVVM pattern in WPF, alot of examples shows how to implement model to viewModel, but models in that examples are just simple classes, I want to use MVVM together with entity framework model (base first approach). Whats the best way to wire model to viewModel. Thanks for answers. //ctor of ViewModel public ViewModel() { db = new PackageShipmentDBEntities(); // Entity Framework generated class ListaZBazy = new ObservableCollection<Pack>(db.Packs.Where(w => w.IsSent == false)); } This is my usual ctor of ViewModel, think there is a better way, I was reading about repository pattern, not sure if I can adapt this to WPF MVVM

    Read the article

  • Installing a .NET framework on Windows 7?

    - by user23392
    I just switched to windows 7 from Vista and a lot of programs/games don't work anymore. The issue is that some games need a specific .NET framework version. when I try to install that it says that I should turn on/off windows features. I go to that and I find .NET framework in the list and tried both checking it and unchecking it. Both don't work and I still get the message that I need to turn on/off that thing. Any suggestion please? I have Windows 7 Ultimate 32-bit.

    Read the article

  • Design for a machine learning artificial intelligence framework

    - by Lirik
    This is a community wiki which aims to provide a good design for a machine learning/artificial intelligence framework (ML/AI framework). Please contribute to the design of a language-agnostic framework which would allow multiple ML/AI algorithms to be plugged into a single framework which: runs the algorithms with a user-specified data set. facilitates learning, qualification, and classification. allows users to easily plug in new algorithms. can aggregate or create an ensemble of the existing algorithms. can save/load the progress of the algorithm (i.e. save the network and weights of a neural network, save the tree of a decision tree, etc.). What is a good design for this sort of ML/AI framework?

    Read the article

  • Design for a machine learning artificial intelligence framework (community wiki)

    - by Lirik
    This is a community wiki which aims to provide a good design for a machine learning/artificial intelligence framework (ML/AI framework). Please contribute to the design of a language-agnostic framework which would allow multiple ML/AI algorithms to be plugged into a single framework which: runs the algorithms with a user-specified data set. facilitates learning, qualification, and classification. allows users to easily plug in new algorithms. can aggregate or create an ensemble of the existing algorithms. can save/load the progress of the algorithm (i.e. save the network and weights of a neural network, save the tree of a decision tree, etc.). What is a good design for this sort of ML/AI framework?

    Read the article

  • django-rest-framework: api versioning

    - by w--
    so googling around it appears that the general consensus is that embedding version numbers in REST URIs is a bad practice and a bad idea. even on SO there are strong proponents supporting this. e.g. Best practices for API versioning? My question is about how to accomplish the proposed solution of using the accept header / content negotiation in the django-rest-framework to accomplish this. It looks like content negotiation in the framework, http://django-rest-framework.org/api-guide/content-negotiation.html is already configured to automatically return intended values based on accepted MIME types. If I start using the Accept header for custom types, I'll lose this benefit of the framework. Is there a better way to accomplish this in the framework?

    Read the article

  • Entity Framework 4.0: Why Would One Use the Code Generated EntityObjects Over POCO Objects?

    - by senfo
    Aside from faster development time (Visual Studio 2010 beta 2 has no T4 templates for building POCO entity objects that I'm aware of), are there any advantages to using the traditional EntityObject entities that Entity Framework creates, by default? If Microsoft delivers a T4 template for building POCO objects, I'm trying to figure out why anybody would want to use the traditional method.

    Read the article

  • Dump Linq-To-Sql now that Entity Framework 4.0 has been released?

    - by DanM
    The relative simplicity of Linq-To-Sql as well as all the criticism leveled at version 1 of Entity Framework (especially, the vote of no confidence) convinced me to go with Linq-To-Sql "for the time being". Now that EF 4.0 is out, I wonder if it's time to start migrating over to it. Questions: What are the pros and cons of EF 4.0 relative to Linq-To-Sql? Is EF 4.0 finally ready for prime time? Is now the time to switch over?

    Read the article

  • Entity Framework 4 CTP 5 POCO - Many-to-many configuration, insertion, and update?

    - by Saxman
    I really need someone to help me to fully understand how to do many-to-many relationship with Entity Framework 4 CTP 5, POCO. I need to understand 3 concepts: How to config my model to indicates some tables are many-to-many. How to properly do insert. How to properly do update. Here are my current models: public class MusicSheet { [Key] public int ID { get; set; } public string Title { get; set; } public string Key { get; set; } public virtual ICollection<Author> Authors { get; set; } public virtual ICollection<Tag> Tags { get; set; } } public class Author { [Key] public int ID { get; set; } public string Name { get; set; } public string Bio { get; set; } public virtual ICollection<MusicSheet> MusicSheets { get; set; } } public class Tag { [Key] public int ID { get; set; } public string TagName { get; set; } public virtual ICollection<MusicSheet> MusicSheets { get; set; } } As you can see, the MusicSheet can have many Authors or Tags, and an Author or Tag can have multiple MusicSheets. Again, my questions are: What to do on the EntityTypeConfiguration to set the relationship between them as well as mapping to an table/object that associates with the many-to-many relationship. How to insert a new music sheets (where it might have multiple authors or multiple tags). How to update a music sheet. For example, I might set TagA, TagB to MusicSheet1, but later I need to change the tags to TagA and TagC. It seems like I need to first check to see if the tags already exists, if not, insert the new tag and then associate it with the music sheet (so that I doesn't re-insert TagA?). Or this is something already handled by the framework? Thank you very much. I really hope to fully understand it rather than just doing it without fully understand what's going on. Especially on #3.

    Read the article

  • impossible to install Framework 3.5

    - by yae
    Hi few days ago I formatted one of my computers (XP Home SP2 with prior updates installed). Now I am trying to install NET Framework 3.5, but display this error: [03/21/10,17:19:36] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603 [03/21/10,17:20:17] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed. Already i have tried this to try solve this issue, but the problem persists. 1.- unistall all frameworks and reinstall from scratch 2.- clean all temps file and reinstall from scratch 3.- unistall and clean all frameworks with dotnetfx cleanup tool and reinstall from scratch 4.- install .NET Framework 3.5 full package But all these possibles solutions have failed. Any idea to solve this? Thanks in advance

    Read the article

  • Framework 4 Features: Summary of Security enhancements

    - by Anthony Shorten
    In the last log entry I mentioned one of the new security features in Oracle Utilities Application Framework 4.0.1. Security is one of the major "tent poles" (to borrow a phrase from Steve Jobs) in this release of the framework. There are a number of security related enhancements requested by customers and as a result of internal reviews that we have introduced. Here is a summary of some of the security enchancements we have added in this release: Security Cache Changes - Security authorization information is automatically cached on the server for performance reasons (security is checked for every single call the product makes for all modes of access). Prior to this release the cache auto-refreshed every 30 minutes (or so). This has beem made more nimble by supporting a cache refresh every minute (or so). This means authorization changes are reflected quicker than before. Business Level security - Business Services are configurable services that are based upon Application Services. Typically, the business service inherited its security profile from its parent service. Whilst this is sufficient for most needs, it is now required to further specify security on the Business Service definition itself. This will allow granular security and allow the same application service to be exposed as different Business Services with their own security. This is particularly useful when you base a Business Service on a query zone. User Propogation - As with other client server applications, the database connections are pooled and shared as needed. This means that a common database user is used to access the database from the pool to allow sharing. Unfortunently, this means that tracability at the database level is that much harder. In Oracle Utilities Application Framework V4 the end userid is now propogated to the database using the CLIENT_IDENTIFIER as part of the Oracle JDBC connection API. This not only means that the common database userid is still used but the end user is indentifiable for the duration of the database call. This can be used for monitoring or to hook into Oracle's database security products. This enhancement is only available to Oracle Database customers. Enhanced Security Definitions - Security Administrators use the product browser front end to control access rights of defined users. While this is sufficient for most sites, a new security portal has been introduced to speed up the maintenance of security information. Oracle Identity Manager Integration - With the popularity of Oracle's Identity Management Suite, the Framework now provides an integration adapter and Identity Manager Generic Transport Connector (GTC) to allow users and group membership to be provisioned to any Oracle Utilities Application Framework based product from Oracle's Identity Manager. This is also available for Oracle Utilties Application Framework V2.2 customers. Refer to My Oracle Support KBid 970785.1 - Oracle Identity Manager Integration Overview. Audit On Inquiry - Typically the configurable audit facility in the Oracle Utilities Application Framework is used to audit changes to records. In Oracle Utilities Application Framework the Business Services and Service Scripts could be configured to audit inquiries as well. Now it is possible to attach auditing capabilities to zones on the product (including base package ones). Time Zone Support - In some of the Oracle Utilities Application Framework based products, the timezone of the end user is a factor in the processing. The user object has been extended to allow the recording of time zone information for use in product functionality. JAAS Suport - Internally the Oracle Utilities Application Framework uses a number of techniques to validate and transmit security information across the architecture. These various methods have been reconciled into using Java Authentication and Authorization Services for standardized security. This is strictly an internal change with no direct on how security operates externally. JMX Based Cache Management - In the last bullet point, I mentioned extra security applied to cache management from the browser. Alternatively a JMX based interface is now provided to allow IT operations to control the cache without the browser interface. This JMX capability can be initiated from a JSR120 compliant JMX console or JMX browser. I will be writing another more detailed blog entry on the JMX enhancements as it is quite a change and an exciting direction for the product line. Data Patch Permissions - The database installer provided with the product required lower levels of security for some operations. At some sites they wanted the ability for non-DBA's to execute the utilities in a controlled fashion. The framework now allows feature configuration to allow delegation for patch execution. User Enable Support - At some sites, the use of temporary staff such as contractors is commonplace. In this scenario, temporary security setups were required and used. A potential issue has arisen when the contractor left the company. Typically the IT group would remove the contractor from the security repository to prevent login using that contractors userid but the userid could NOT be removed from the authorization model becuase of audit requirements (if any user in the product updates financials or key data their userid is recorded for audit purposes). It is now possible to effectively diable the user from the security model to prevent any use of the useridwhilst retaining audit information. These are a subset of the security changes in Oracle Utilities Application Framework. More details about the security capabilities of the product is contained in My Oracle Support KB Id 773473.1 - Oracle Utilities Application Framework Security Overview.

    Read the article

  • A list of Entity Framework providers for various databases

    - by Robert Koritnik
    Which providers are there and your experience using them I would like to know about all possible native .net Framework Entity Framework providers that are out there as well as their limitations compared to the default Linq2Entities (from MS for MS SQL). If there are more for the same database even better. Tell me and I'll be updating this post with this list. Feel free to add additional providers directly into this post or provide an answer and others (including me) will add it to the list. Entity Framework 1 Microsoft SQL Server Standard/Enterprise/Express Linq 2 Entities - Microsoft SQL Server connector DataDirect ADO.NET Data Providers Microsoft SQL Server CE (Compact Edition) Any provider? MySQL MySQL Connector (since version 6.0) - I've read about issues when using Skip(), Take() and Sort() in the same expression tree - everyone welcome to input their experience/knowledge regarding this. (NOTE: MySQL Connector/NET Visual Studio Integration is not supported in the Express Editions of Visual Studio, meaning you won't be able to view MySQL databases in the Database explorer window or add a MySQL data source via Visual Studio wizard dialog boxes. Some users may find that this limits their ability to use Entity Framework and MySQL within Visual Studio Express). Devart dotConnect for MySQL - similar issues to MySql's connector as I've read and both try to blame MS for it [these issues are supposed to be solved] SQLite Devart dotConnect for SQLite System.Data.SQLite PostgreSQL Devart dotConnect for PostgreSQL Npgsql Oracle Devart dotConnect for Oracle Sample Entity Framework Provider for Oracle - community effort project DataDirect ADO.NET Data Providers DB2 IBM Data Server Provider has EF support. Here are some limitations. DataDirect ADO.NET Data Providers Sybase Sybase iAnywhere DataDirect ADO.NET Data Providers Informix IBM Data Server Provider supports Informix Firebird ADO.NET Data Provider with EF support Provider Wrappers Tracing and Caching Providers for EF Entity Framework 4 (beta) Microsoft SQL Server Microsoft's Linq to Entities 4 - shipped with .net 4.0 and Visual Studio 2010; so far the only provider for EF4 MySQL Devart dotConnect for MySQL SQLite Devart dotConnect for SQLite PostgreSQL Devart dotConnect for PostgreSQL Oracle Devart dotConnect for Oracle

    Read the article

  • VS2010 / Target Framework = 3.5 / Building on Continuous Integration Server

    - by granadaCoder
    I'm checking into upgrading to VS2010. Our production servers only have 3.5 Framework and it will be 6-9 months before they are updated. We also have a Continuous Integration Server, running CruiseControl.NET (CC.NET). It has the 3.5 Framework on it as well. Our implementation of CC.NET mainly calls msbuild.exe MySolution.msbuild. (We encapsulate most of the build logic into .msbuild files fyi) Inside the .msbuild file, the following is the "Build" syntax: < Target Name="Build" DependsOnTargets="Checkout" < MSBuild Projects="$(WorkingCheckout)\MySolution.sln" Targets="Build" Properties="Configuration=$(Configuration)" < Output TaskParameter="TargetOutputs" ItemName="TargetOutputsItemName"< /Output < /MSBuild < /Target (A few spaces added to make it display here) =========== I know the VS2010 can "Target" the 3.5 Framework. My question is what happens when I have a VS2010 dev machine, and I check the VS2010 .sln and .csproj(s) files into source control (svn, btw).....will the CC.NET machine ~~which only have the 3.5 Framework installed on it........be able to build the .sln ? I guess I could test it, but the catch22 is that I don't have VS2010 (yet). So I'm asking before I try (the trial or a real install. ............. Any ideas what will happen? I guess the crux question is, what will happen. c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe "MyVS2010SolutionFile.sln" ?? My hopeful goal would be, allow the developers to have VS2010 (now!), and it still be "ok" for the CC.NET machine and the Production Servers which will only have the 3.5 Framework on them for the foreseeable future. Just to be clear, developers NEVER create deployable builds. Only the CC.NET machine produces builds that will be pushed as production builds. Any help?

    Read the article

  • Installing SQL Server Compact 3.5 SP2 *after* installing SQL 2012 RC0 - machine.config path include double slashes?

    - by Sigmund
    I'm trying to install SQL Compact 3.5 SP2 after I've installed SQL 2012 RC0, on a x64 Windows 7. The x86 installer goes through fine. The x64 installer fails, with the error: "Error 25543.Failed to save changes to XML file c:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config, system error: -2147024864" Note the \CONFIG (double backslash) where there should be a single backslash... any ideas why this is happening and how to solve it?

    Read the article

  • GuestPost: Unit Testing Entity Framework (v1) Dependent Code using TypeMock Isolator

    - by Eric Nelson
    Time for another guest post (check out others in the series), this time bringing together the world of mocking with the world of Entity Framework. A big thanks to Moses for agreeing to do this. Unit Testing Entity Framework Dependent Code using TypeMock Isolator by Muhammad Mosa Introduction Unit testing data access code in my opinion is a challenging thing. Let us consider unit tests and integration tests. In integration tests you are allowed to have environmental dependencies such as a physical database connection to insert, update, delete or retrieve your data. However when performing unit tests it is often much more efficient and productive to remove environmental dependencies. Instead you will need to fake these dependencies. Faking a database (also known as mocking) can be relatively straight forward but the version of Entity Framework released with .Net 3.5 SP1 has a number of implementation specifics which actually makes faking the existence of a database quite difficult. Faking Entity Framework As mentioned earlier, to effectively unit test you will need to fake/simulate Entity Framework calls to the database. There are many free open source mocking frameworks that can help you achieve this but it will require additional effort to overcome & workaround a number of limitations in those frameworks. Examples of these limitations include: Not able to fake calls to non virtual methods Not able to fake sealed classes Not able to fake LINQ to Entities queries (replace database calls with in-memory collection calls) There is a mocking framework which is flexible enough to handle limitations such as those above. The commercially available TypeMock Isolator can do the job for you with less code and ultimately more readable unit tests. I’m going to demonstrate tackling one of those limitations using MoQ as my mocking framework. Then I will tackle the same issue using TypeMock Isolator. Mocking Entity Framework with MoQ One basic need when faking Entity Framework is to fake the ObjectContext. This cannot be done by passing any connection string. You have to pass a correct Entity Framework connection string that specifies CSDL, SSDL and MSL locations along with a provider connection string. Assuming we are going to do that, we’ll explore another limitation. The limitation we are going to face now is related to not being able to fake calls to non-virtual/overridable members with MoQ. I have the following repository method that adds an EntityObject (instance of a Blog entity) to Blogs entity set in an ObjectContext. public override void Add(Blog blog) { if(BlogContext.Blogs.Any(b=>b.Name == blog.Name)) { throw new InvalidOperationException("Blog with same name already exists!"); } BlogContext.AddToBlogs(blog); } The method does a very simple check that the name of the new Blog entity instance doesn’t exist. This is done through the simple LINQ query above. If the blog doesn’t already exist it simply adds it to the current context to be saved when SaveChanges of the ObjectContext instance (e.g. BlogContext) is called. However, if a blog with the same name exits, and exception (InvalideOperationException) will be thrown. Let us now create a unit test for the Add method using MoQ. [TestMethod] [ExpectedException(typeof(InvalidOperationException))] public void Add_Should_Throw_InvalidOperationException_When_Blog_With_Same_Name_Already_Exits() { //(1) We shouldn't depend on configuration when doing unit tests! But, //its a workaround to fake the ObjectContext string connectionString = ConfigurationManager .ConnectionStrings["MyBlogConnString"] .ConnectionString; //(2) Arrange: Fake ObjectContext var fakeContext = new Mock<MyBlogContext>(connectionString); //(3) Next Line will pass, as ObjectContext now can be faked with proper connection string var repo = new BlogRepository(fakeContext.Object); //(4) Create fake ObjectQuery<Blog>. Will be used to substitute MyBlogContext.Blogs property var fakeObjectQuery = new Mock<ObjectQuery<Blog>>("[Blogs]", fakeContext.Object); //(5) Arrange: Set Expectations //Next line will throw an exception by MoQ: //System.ArgumentException: Invalid setup on a non-overridable member fakeContext.SetupGet(c=>c.Blogs).Returns(fakeObjectQuery.Object); fakeObjectQuery.Setup(q => q.Any(b => b.Name == "NewBlog")).Returns(true); //Act repo.Add(new Blog { Name = "NewBlog" }); } This test method is checking to see if the correct exception ([ExpectedException(typeof(InvalidOperationException))]) is thrown when a developer attempts to Add a blog with a name that’s already exists. On (1) a connection string is initialized from configuration file. To retrieve the full connection string. On (2) a fake ObjectContext is being created. The ObjectContext here is MyBlogContext and its being created using this var fakeContext = new Mock<MyBlogContext>(connectionString); This way a fake context is being created using MoQ. On (3) a BlogRepository instance is created. BlogRepository has dependency on generate Entity Framework ObjectContext, MyObjectContext. And so the fake context is passed to the constructor. var repo = new BlogRepository(fakeContext.Object); On (4) a fake instance of ObjectQuery<Blog> is being created to use as a substitute to MyObjectContext.Blogs property as we will see in (5). On (5) setup an expectation for calling Blogs property of MyBlogContext and substitute the return result with the fake ObjectQuery<Blog> instance created on (4). When you run this test it will fail with MoQ throwing an exception because of this line: fakeContext.SetupGet(c=>c.Blogs).Returns(fakeObjectQuery.Object); This happens because the generate property MyBlogContext.Blogs is not virtual/overridable. And assuming it is virtual or you managed to make it virtual it will fail at the following line throwing the same exception: fakeObjectQuery.Setup(q => q.Any(b => b.Name == "NewBlog")).Returns(true); This time the test will fail because the Any extension method is not virtual/overridable. You won’t be able to replace ObjectQuery<Blog> with fake in memory collection to test your LINQ to Entities queries. Now lets see how replacing MoQ with TypeMock Isolator can help. Mocking Entity Framework with TypeMock Isolator The following is the same test method we had above for MoQ but this time implemented using TypeMock Isolator: [TestMethod] [ExpectedException(typeof(InvalidOperationException))] public void Add_New_Blog_That_Already_Exists_Should_Throw_InvalidOperationException() { //(1) Create fake in memory collection of blogs var fakeInMemoryBlogs = new List<Blog> {new Blog {Name = "FakeBlog"}}; //(2) create fake context var fakeContext = Isolate.Fake.Instance<MyBlogContext>(); //(3) Setup expected call to MyBlogContext.Blogs property through the fake context Isolate.WhenCalled(() => fakeContext.Blogs) .WillReturnCollectionValuesOf(fakeInMemoryBlogs.AsQueryable()); //(4) Create new blog with a name that already exits in the fake in memory collection in (1) var blog = new Blog {Name = "FakeBlog"}; //(5) Instantiate instance of BlogRepository (Class under test) var repo = new BlogRepository(fakeContext); //(6) Acting by adding the newly created blog () repo.Add(blog); } When running the above test method it will pass as the Add method of BlogRepository is going to throw an InvalidOperationException which is the expected behaviour. Nothing prevents us from faking out the database interaction! Even faking ObjectContext  at (2) didn’t require a connection string. On (3) Isolator sets up a faking result for MyBlogContext.Blogs when its being called through the fake instance fakeContext created on (2). The faking result is just an in-memory collection declared an initialized on (1). Finally at (6) action we call the Add method of BlogRepository passing a new Blog instance that has a name that’s already exists in the fake in-memory collection which we set up at (1). As expected the test will pass because it will throw the expected exception defined on top of the test method - InvalidOperationException. TypeMock Isolator succeeded in faking Entity Framework with ease. Conclusion We explored how to write a simple unit test using TypeMock Isolator for code which is using Entity Framework. We also explored a few of the limitations of other mocking frameworks which TypeMock is successfully able to handle. There are workarounds that you can use to overcome limitations when using MoQ or Rhino Mock, however the workarounds will require you to write more code and your tests will likely be more complex. For a comparison between different mocking frameworks take a look at this document produced by TypeMock. You might also want to check out this open source project to compare mocking frameworks. I hope you enjoyed this post Muhammad Mosa http://mosesofegypt.net/ http://twitter.com/mosessaur Screencast of unit testing Entity Framework Related Links GuestPost: Introduction to Mocking GuesPost: Typemock Isolator – Much more than an Isolation framework

    Read the article

  • Thunderbird compact is taking forever

    - by mulllhausen
    One day I came in to work and found that our development server - a Ubuntu box had a full hard disk. I did a bit of investigation using the du command and it seems like mozilla thunderbird is the major culprit. After burning off some backups, the disk was left at 94%: $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 895G 791G 59G 94% / none 4.0G 300K 4.0G 1% /dev none 4.0G 1.4M 4.0G 1% /dev/shm none 4.0G 140K 4.0G 1% /var/run none 4.0G 0 4.0G 0% /var/lock none 4.0G 0 4.0G 0% /lib/init/rw $ cd $ du -ch | grep [0-9]G 666G ./.thunderbird/ccsmcruu.default/ImapMail/mail.adofms.com.au 666G ./.thunderbird/ccsmcruu.default/ImapMail 667G ./.thunderbird/ccsmcruu.default 667G ./.thunderbird 2.2G ./.VirtualBox/Machines/iBike/Snapshots 2.2G ./.VirtualBox/Machines/iBike 2.2G ./.VirtualBox/Machines 2.2G ./.VirtualBox 670G . 670G total I did some reading and found that Mozilla Thunderbird does not compact files by default - i.e. all of the old emails that were sent to trash are still kept. One of the mailboxes used to get a lot of spam so I guess this accounts for the 667GB. I opened up Thunderbird to see how much space the inbox actually takes up and it turns out to be approximately 500MB - over 1000 times less than the stuff that has not been compacted over the years. So i right clicked on the inbox directory in the tree on the left of Thunderbird and selected 'compact'. I left it for about 12hours but even after that it still said 'compacting folder' on the status bar. I don't use Thunderbird on this PC - it belonged to a colleague who has left the company, however I do occasionally need to look through the inbox for references to the project I am working on, so deleting all traces of Thunderbird is not an option. My question is - is there any way I can monitor the progress of Thunderbird's compacting function? I would really like to know how long it is going to take. Also is there any way I can speed up the compacting process?

    Read the article

  • Windows CE and the Compact Framework are dead?

    - by Valter Minute
    This is one of the question that I’ve been asked more and more frequently at my public speeches and each time I meet customers. The announcement of the new Windows Phone 7 platform and the release of Visual Studio 2010 generated a bit of confusion around Windows CE and some of the technologies it supports. Windows CE is still alive and a lot of good programmers are working on the new releases (I had a chance to know some of them during the MVP summit in February). Here’s a blog post from Olivier Bloch that describes the situation and provides some good news about the OS: http://blogs.msdn.com/obloch/archive/2010/05/03/windows-ce-is-not-dead.aspx As you can read here, Windows Phone 7 keeps its “roots” inside Windows CE. Regarding the .NET Compact Framework, this article from the excellent “I know the answer (it’s 42)” blog from Abhinaba (it seems that we share a passion for photography, Douglas Adams and embedded development), explains that the .NET CF is the foundation of XNA and Silverlight implementation on the WP7 platform: http://blogs.msdn.com/abhinaba/archive/2010/03/18/what-is-netcf.aspx So Windows CE is here to stay, powering one of the most interesting smart phone platforms and ready to power also your devices. Add those blogs to your RSS reader list and stay tuned for more good news about CE and the Compact Framework!

    Read the article

  • What functionality should a (basic) mock framework have?

    - by user1175327
    If i would start on writing a simple Mock framework, then what are the things that a basic mock framework MUST have? Obviously mocking any object, but what about assertions and perhaps other things? When I think of how I would write my own mock framework then I realise how much I really know (or don't know) and what I would trip up on. So this is more for educational purposes. Of course I did research and this is what i've come up with that a minimal mocking framework should be able to do. Now my question in this whole thing is, am I missing some important details in my ideas? Mocking Mocking a class: Should be able to mock any class. The Mock should preserve the properties and their original values as they were set in the original class. All method implementations are empty. Calls to methods of Mock: The Mock framework must be able to define what a mocked method must return. IE: $MockObj->CallTo('SomeMethod')->Returns('some value'); Assertions To my understanding mocking frameworks also have a set of assertions. These are the ones I think are most important (taken from SimpleTest). expect($method, $args) Arguments must match if called expectAt($timing, $method, $args) Arguments must match when called on the $timing'th time expectCallCount($method, $count) The method must be called exactly this many times expectMaximumCallCount($method, $count) Call this method no more than $count times expectMinimumCallCount($method, $count) Must be called at least $count times expectNever($method) Must never be called expectOnce($method, $args) Must be called once and with the expected arguments if supplied expectAtLeastOnce($method, $args) Must be called at least once, and always with any expected arguments And that's basically, as far as I understand, what a mock framework should be able to do. But is this really everything? Because it currently doesn't seem like a big deal to build something like this. But that's also the reason why I have the feeling that i'm missing some important details about such a framework. So is my understanding right about a mock framework? Or am i missing alot of details?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >