Search Results

Search found 6735 results on 270 pages for 'pre commit'.

Page 4/270 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Useful git commit messages for merged branches

    - by eykanal
    As a follow-up to this question: If I'm working on a team by myself, I can maintain useful commit messages when merging branches by squashing all the commits to a single diff and then merging that diff. That way I can easily see what changes were introduced in the branch, and I have a single summary describing the feature/change/whatever that was accomplished in that branch when browsing the master branch. My question now is, how can I accomplish this when working with a team? In that situation, the branches will be pushed to a remote repository, meaning that I can't squash all the commits in the branch down to a single commit. If the branch is public, can I still have a single useful merge commit in the master branch? (By "useful" I mean that the commit in the master line tells me (1) a useful summary of what was done in the branch and (2) diffs of the same.)

    Read the article

  • git: remove 2nd commit

    - by cwolves
    I'm trying to remove the 2nd commit to a repo. At this point I could just blow away the .git dir and re-do it, but I'm curious how to do this... I've deleted commits before, but apparently never the 2nd one :) > git log commit c39019e4b08497406c53ceb532f99801793205ca Author: Me Date: Thu Mar 22 14:02:41 2012 -0700 Initializing registry directories commit 535dce28f1c68e8af9d22bc653aca426fb7825d8 Author: Me Date: Tue Jan 31 21:04:13 2012 -0800 First Commit > git rebase -i HEAD~2 fatal: Needed a single revision invalid upstream HEAD~2 > git rebase -i HEAD~1 at which point I get in my editor: pick c39019e Initializing registry directories # Rebase 535dce2..c39019e onto 535dce2 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # Now my problem is that I can't just blow away this 2nd commit since "if you remove everything, the rebase will be aborted"

    Read the article

  • git - how do we verify commit messages for a push?

    - by shovas
    Coming from CVS, we have a policy that commit messages should be tagged with a bug number (simple suffix "... [9999]"). A CVS script checks this during commits and rejects the commit if the message does not conform. The git hook commit-msg does this on the developer side but we find it helpful to have automated systems check and remind us of this. During a git push, commit-msg isn't run. Is there another hook during push that could check commit messages? How do we verify commit messages during a git push?

    Read the article

  • A file was added to git on commit n. How do I add it instead to commit n-m?

    - by carleeto
    I have a branch. Half way through I noticed git was not tracking a file that it should have been and so I added it as part of a commit and continued with my work. Now, I'm doing a git bisect and all commits before the file was added do not build. So I'm thinking, I need to split the commit that added the file into two parts: the file add and the rest of the commit. I then need to re-order the commits so that the file add commit will be at the beginning of my branch. Is this the correct solution or is there a better way of doing it?

    Read the article

  • Git: Merge in only one commit

    - by Ivan
    Usually, I work with branches in Git, but I don't like to see hundreds of branches in my working tree (Git history). I'm wondering if there is a method in Git to "join" all commits in a branch in only one commit (ideally with a clear commit message). Something like this: git checkout -b branch <some work> git commit -a -m "commit 1" <some work> git commit -a -m "commit 2" <some work> git commit -a -m "commit 3" git checkout master git SUPER-JOIN branch -m "super commit" After this, only "super commit" will exist in the git log.

    Read the article

  • Can any Palm Pre be used for development?

    - by teedyay
    We're about to start developing software for the Palm, using WebOS. Though an emulator is available for testing, I always feel more confident seeing it run on a physical device as well. I can't find anywhere on Palm's website that tells me whether I can just buy an off-the-shelf Palm Pre and run my app on it, or if I have to buy one with a particular type of contract/ have it unlocked in some way/ whatever. Does anyone know? Have you done this? (Sorry this is barely programming-related, but I couldn't think where else to ask. I'm sure someone has done this and can give me a quick yay or nay. Thanks.) Oh - I'm in the UK, if that makes any difference.

    Read the article

  • Force WPF to Commit Changes on Focused Element

    - by John L.
    I'm working with VS2010, WPF and EF. I've placed controls on my window by dragging an entity out of the Data Sources toolwindow. I used the "details" setting so my entity is represented by several labels and textboxes. I've also added a button with the following code: _context.SaveChanges(); When I'm editing data, the changes in whichever textbox has focus are not committed back to the DB. Everything else commits just fine. If I shift focus to another element prior to hitting the save button, it commits as well. I've experienced the same thing with the DataGrid. I know I'm missing something simple, but I can figure it out. Any ideas on what I'm missing? Thanks!

    Read the article

  • SQL Saturday #220 - Atlanta - Pre-Conference Scholarships!

    - by Most Valuable Yak (Rob Volk)
    We Want YOU…To Learn! AtlantaMDF and Idera are teaming up to find a few good people. If you are: A student looking to work in the database or business intelligence fields A database professional who is between jobs or wants a better one A developer looking to step up to something new On a limited budget and can’t afford professional SQL Server training Able to attend training from 9 to 5 on May 17, 2013 AtlantaMDF is presenting 5 Pre-Conference Sessions (pre-cons) for SQL Saturday #220! And thanks to Idera’s sponsorship, we can offer one free ticket to each of these sessions to eligible candidates! That means one scholarship per Pre-Con! One Recipient Each will Attend: Denny Cherry: SQL Server Security http://sqlsecurity.eventbrite.com/ Adam Machanic: Surfing the Multicore Wave: Processors, Parallelism, and Performance http://surfmulticore.eventbrite.com/ Stacia Misner: Languages of BI http://languagesofbi.eventbrite.com/ Bill Pearson: Practical Self-Service BI with PowerPivot for Excel http://selfservicebi.eventbrite.com/ Eddie Wuerch: The DBA Skills Upgrade Toolkit http://dbatoolkit.eventbrite.com/ If you are interested in attending these pre-cons send an email by April 30, 2013 to [email protected] and tell us: Why you are a good candidate to receive this scholarship Which sessions you’d like to attend, and why (list multiple sessions in order of preference) What the session will teach you and how it will help you achieve your goals The emails will be evaluated by the good folks at Midlands PASS in Columbia, SC. The recipients will be notified by email and announcements made on May 6, 2013. GOOD LUCK! P.S. - Don't forget that SQLSaturday #220 offers free* training in addition to the pre-cons! You can find more information about SQL Saturday #220 at http://www.sqlsaturday.com/220/eventhome.aspx. View the scheduled sessions at http://www.sqlsaturday.com/220/schedule.aspx and register for them at http://www.sqlsaturday.com/220/register.aspx. * Registration charges a $10 fee to cover lunch expenses.

    Read the article

  • UPK Pre-built Content Now Available for Additional Product Lines

    - by Karen Rihs
    UPK pre-built content development efforts are always underway and growing, and now include the recent release of new UPK pre-built content modules for three additional product lines! Oracle Utilities for Meter Data Management 2.0.1 Administrative Setup User Tasks VEE and Usage Rules Working with Measurement Data Fusion 11g Release 1 Functional Setup Manager General Ledger Global Human Resources Project Portfolio Management Self Service Procurement Oracle Crystal Ball 11.1.2 Oracle Crystal Ball For the most recent list of modules currently available for each product line, visit the UPK Resource Library on Oracle.com. For more information on how your organization can take advantage of UPK pre-built content, see our previous blog, The Value of UPK Pre-Built Content.  - Karen Rihs, UPK Outbound Product Management

    Read the article

  • Is there a way to accumulate a commit message with git while examing changes?

    - by carleeto
    I use "git add -p" to stage my changes. What I'd like to be able to do is to accumulate a commit message as I'm examining my changes and then when I call "git commit", it is already filled out for me and allows me to make changes before I commit. Now, its easy to do with git gui by simply examining the changes and editing the commit message text box accordingly, but I'm a command line guy and was wondering if this is possible at the command line.

    Read the article

  • On improving commit practices

    - by greengit
    I was thinking about ways to improving my commit practices. Is there any co-relation between no. of source code lines and no. of commits? In a recent project that I was involved in, I was going at 30 commits per 1000 lines. One typical file from the project has these stats language: JavaScript total commits that include this file: 32 total lines: 1408 source lines: 1140 comment lines: 98 no. of function declarations: 28 other declarations: 8 Another file has these... Language: Python total commits that include this file: 17 total lines: 933 source lines: 730 comment lines: 80 classes: 1 methods: 10 I also think that no. of commits is more related to no. of features or no. of changes to the code and less to the no. of lines. The general git community motto is make short commits and commit often. So, do you really think about you commit strategy before you start the project. For that matter, is there anything like commit strategy? If so, what's yours?

    Read the article

  • VS2008 Pre-Build Event Command BuildAction=None

    - by Frederick
    Hi Guys, I am trying to add a prebuild even command line which essentially sets Build Action = None For a list of files before the solution is packaged up for release. How would I go about adding this & what command would I use to exclude a number of files in the web solution ? i.e. \script\some-script.js [Set Build Action = None] etc \script\some-script2.js [Set Build Action = None] etc ?

    Read the article

  • Defines JEE 5 the handling of commit error using bean managed transactions?

    - by marabol
    I'm using glassfish 2.1 and 2.1.1. If I've a bean method annotated by @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW). After doing some JPA stuff the commit fails in the afterCompletion-Phase of JTS. GlassFish logs this failure only. And the caller of this bean method has no chance to know something goes wrong. So I wonder, if there is any definition how a jee 5 server has to handle exceptions while commiting. I would expect any runtime exception. I'm using stateless beans. With SessionSynchronisation I could get the commit failue, if I use statefull beans. Is it possible to intercept, so I can throw an exception, that I've declared in my interface? This is the whole exception stacktrace: [#|2010-05-06T12:15:54.840+0000|WARNING|sun-appserver2.1|oracle.toplink.essentials.session.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/my-ear-1.0.0-SNAPSHOT/my-jar-1.1.8_jar/-myPu.transaction|_ThreadID=25;_ThreadName=p: thread-pool-1; w: 15;_RequestID=67a475a1-25c3-4416-abea-0d159f715373;| java.lang.RuntimeException: Got exception during XAResource.end: oracle.jdbc.xa.OracleXAException at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.delistResource(J2EETransactionManagerOpt.java:224) at com.sun.enterprise.resource.ResourceManagerImpl.unregisterResource(ResourceManagerImpl.java:265) at com.sun.enterprise.resource.ResourceManagerImpl.delistResource(ResourceManagerImpl.java:223) at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:400) at com.sun.enterprise.resource.ConnectorAllocator$ConnectionListenerImpl.connectionClosed(ConnectorAllocator.java:72) at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:639) at com.sun.gjc.spi.base.ConnectionHolder.close(ConnectionHolder.java:201) at com.sun.gjc.spi.jdbc40.ConnectionHolder40.close(ConnectionHolder40.java:519) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:394) at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:382) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:417) at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:115) at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:119) at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1841) at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:170) at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:102) at com.sun.jts.jta.SynchronizationImpl.after_completion(SynchronizationImpl.java:154) at com.sun.jts.CosTransactions.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:210) at com.sun.jts.CosTransactions.TopCoordinator.afterCompletion(TopCoordinator.java:2585) at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:433) at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:250) at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:623) at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:309) at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:1029) at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:398) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3817) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3610) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1379) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127) at $Proxy127.myNewTxMethod(Unknown Source) at mypackage.MyBean2.myMethod(MyBean2.java:197) at mypackage.MyBean2.myMethod2(MyBean2.java:166) at mypackage.MyBean2.myMethod3(MyBean2.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127) at $Proxy158.myMethod3(Unknown Source) at mypackage.MyBean3.myMethod4(MyBean3.java:94) at mypackage.MyBean3.onMessage(MyBean3.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:181) at java.security.AccessController.doPrivileged(Native Method) at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:985) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:186) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011) at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111) at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74) at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179) at $Proxy192.onMessage(Unknown Source) at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258) at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555) |#]

    Read the article

  • Rush…iPAD Pre-order announced officially

    - by samsudeen
    Apple’s latest product iPAD is now available for pre-order through online. You can place your pre-order through its online store (Apple) or reserve it at any of the Apple retail stores. iPAD may have received mixed reactions when announced last month. But Apple knows how to sell; it is believed that more than 50,000 pre orders are already placed till now placed till now. People have to wait for another 3 weeks to get the actual device as the launch date is 3rd of April in the US. The initial model released will be available only with Wi-Fi and the planned 3G model is expected to be released by end of April. So how much does it cost you to get this little marvel? The basic iPAD (16 GB Wi-Fi) will cost you $499. if you are serious apple fan and plan to buy an iPAD better place your order now. There already rumours that the initial demand may outstrip supply.The pre-order is limited only to US. Join us on Facebook to read all our stories right inside your Facebook news feed.

    Read the article

  • Oracle RDBMS Server 11gR2 Pre-Install RPM for Oracle Linux 6 has been released

    - by Lenz Grimmer
    Now that the certification of the Oracle Database 11g R2 with Oracle Linux 6 and the Unbreakable Enterprise Kernel has been announced, we are glad to announce the availability of oracle-rdbms-server-11gR2-preinstall, the Oracle RDBMS Server 11gR2 Pre-install RPM package (formerly known as oracle-validated). Designed specifically for Oracle Linux 6, this RPM aids in the installation of the Oracle Database. In order to install the Oracle Database 11g R2 on Oracle Linux 6, your system needs to meet a few prerequisites, as outlined in the Linux Installation Guides. Using the Oracle RDBMS Server 11gR2 Pre-install RPM, you can complete most of the pre-installation configuration tasks. which is now available from the Unbreakable Linux Network, or via the Oracle public yum repository. The pre-install package is available for x86_64 only. Specifically, the package: Causes the download and installation of various software packages and specific versions needed for database installation, with package dependencies resolved via yum Creates the user oracle and the groups oinstall and dba, which are the defaults used during database installation Modifies kernel parameters in /etc/sysctl.conf to change settings for shared memory, semaphores, the maximum number of file descriptors, and so on Sets hard and soft shell resource limits in /etc/security/limits.conf, such as the number of open files, the number of processes, and stack size to the minimum required based on the Oracle Database 11g Release 2 Server installation requirements Sets numa=off in the kernel boot parameters for x86_64 machines Please see the release announcement for further details and instructions. Also take a look at Ginny Henningsen's "How I Simplified Oracle Database Installation on Oracle Linux" article on the Oracle Technology Network for a general description on how to perform the installation of the Oracle Database on Oracle Linux. While the article refers to Oracle Linux 5 and the former "oracle-validated" package, the steps for Oracle Linux 6 are still very similar (we're looking into updating that article for Oracle Linux 6).

    Read the article

  • Git commit messages with nvie branching model

    - by eykanal
    This Git branching model recommends branching for all development efforts and merging when complete: Branch Develop Merge when complete I'm wondering how this works in practice, given that performing a merge off this model will simply add a commit to the develop with whatever commit message happened to be the last one in line. Do people using this model do an interactive rebase on the feature branch before committing? If not, how do you ensure that the commits make sense on the main branch?

    Read the article

  • UPK Pre-Built Content Update

    - by Karen Rihs
    UPK pre-built content development efforts are always underway and growing. Over the last few months, the following new and upgraded modules became available:  NEW CONTENT RELEASES E-Business Suite 12.1 Field Service Manufacturing Operations Center Process Manufacturing:  System Administration Strategic Network Optimization U.S. Federal Financials Oracle Communications 11.1 Oracle Communications UPK for Pricing Design Center, Voice and Data Offerings Oracle Mobile Workforce 2.1.0 Administrative Setup User Tasks Primavera Primavera Portfolio Management 9.0 UPK CONTENT UPGRADES JDE E1 9.1 HCM Fundamentals for EnterpriseOne Manufacturing - Product Data Management Manufacturing Management Discrete Shop Floor Management Procurement and Subcontract Management JDE World A9.3 Accounts Payable Address Book  Common Foundation General Ledger For a list of modules currently available for each product line, visit the UPK Resource Library on Oracle.com. For more information on how your organization can take advantage of UPK pre-built content, see our previous blog,  The Value of UPK Pre-Built Content. - Karen Rihs, UPK Outbound Product Management

    Read the article

  • PeopleTools 8.54 Pre-Release Notes Available

    - by Matthew Haavisto
    PeopleSoft's PeopleTools recently published pre-release notes for PeopleTools 8.54.  Pre-release notes provide more functional and technical details than the release value proposition. This document describes how enhancements function within the context of the greater business process. This added level of detail should enable project teams to answer the following questions: What delivered functionality will change? How will an upgrade or new implementation affect other systems? How will these changes affect the organization? After the project team has reviewed and analyzed the pre-release notes, business decision makers should be able to determine whether to allocate budget and initiate implementation plans. This document covers the following subjects: Platform support enhancements Development tools enhancements System administration tools enhancements Reporting and analytic tools enhancements Integration tools enhancements Lifecycle management tools enhancements Accessibility PeopleSoft Interaction Hub enhancements.

    Read the article

  • How can I undo my last git add/commit ?

    - by dan
    I edited a file and did: git add file.py git commit -m 'fixed bug' I then edited another file and performed a minor bug fix. I don't want two commits, one after the other, showing 'bug fix'. I want one commit with 'bug fixes'. How can I undo the last add/commit and change the first commit message? I was looking at the git reset, git revert, git undo commands but I don't want to screw up my repo with a guess EDIT: Found out how to do it: http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

    Read the article

  • Git: Stage into Commit, what is the right workflow?

    - by Lukasz Lew
    I just created a big piece of code I want to commit in several separate commits. So I can stage relevant parts, commit, stage, commit, ... and so on until I have all my changes commited. The missing part is how can I test whether I split the commit correcty. I.e. whether the part that is in staging area at least compiles? To do that I must somehow bring my work tree to be in sync with index (staging area) without losing the changes to be committed later. What is the right way to do it? What is the quickest way to do it? Update: How to do it with magit?

    Read the article

  • Why not commit unresolved changes?

    - by Explosion Pills
    In a traditional VCS, I can understand why you would not commit unresolved files because you could break the build. However, I don't understand why you shouldn't commit unresolved files in a DVCS (some of them will actually prevent you from committing the files). Instead, I think that your repository should be locked from pushing and pulling, but not committing. Being able to commit during the merging process has several advantages (as I see it): The actual merge changes are in history. If the merge was very large, you could make periodic commits. If you made a mistake, it would be much easier to roll back (without having to redo the entire merge). The files could remain flagged as unresolved until they were marked as resolved. This would prevent pushing/pulling. You could also potentially have a set of changesets act as the merge instead of just a single one. This would allow you to still use tools such as git rerere. So why is committing with unresolved files frowned upon/prevented? Is there any reason other than tradition?

    Read the article

  • Pre-filtering and shaping OData feeds using WCF Data Services and the Entity Framework - Part 1

    - by rajbk
    The Open Data Protocol, referred to as OData, is a new data-sharing standard that breaks down silos and fosters an interoperative ecosystem for data consumers (clients) and producers (services) that is far more powerful than currently possible. It enables more applications to make sense of a broader set of data, and helps every data service and client add value to the whole ecosystem. WCF Data Services (previously known as ADO.NET Data Services), then, was the first Microsoft technology to support the Open Data Protocol in Visual Studio 2008 SP1. It provides developers with client libraries for .NET, Silverlight, AJAX, PHP and Java. Microsoft now also supports OData in SQL Server 2008 R2, Windows Azure Storage, Excel 2010 (through PowerPivot), and SharePoint 2010. Many other other applications in the works. * This post walks you through how to create an OData feed, define a shape for the data and pre-filter the data using Visual Studio 2010, WCF Data Services and the Entity Framework. A sample project is attached at the bottom of Part 2 of this post. Pre-filtering and shaping OData feeds using WCF Data Services and the Entity Framework - Part 2 Create the Web Application File –› New –› Project, Select “ASP.NET Empty Web Application” Add the Entity Data Model Right click on the Web Application in the Solution Explorer and select “Add New Item..” Select “ADO.NET Entity Data Model” under "Data”. Name the Model “Northwind” and click “Add”.   In the “Choose Model Contents”, select “Generate Model From Database” and click “Next”   Define a connection to your database containing the Northwind database in the next screen. We are going to expose the Products table through our OData feed. Select “Products” in the “Choose your Database Object” screen.   Click “Finish”. We are done creating our Entity Data Model. Save the Northwind.edmx file created. Add the WCF Data Service Right click on the Web Application in the Solution Explorer and select “Add New Item..” Select “WCF Data Service” from the list and call the service “DataService” (creative, huh?). Click “Add”.   Enable Access to the Data Service Open the DataService.svc.cs class. The class is well commented and instructs us on the next steps. public class DataService : DataService< /* TODO: put your data source class name here */ > { // This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config) { // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. // Examples: // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead); // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } Replace the comment that starts with “/* TODO:” with “NorthwindEntities” (the entity container name of the Model we created earlier).  WCF Data Services is initially locked down by default, FTW! No data is exposed without you explicitly setting it. You have explicitly specify which Entity sets you wish to expose and what rights are allowed by using the SetEntitySetAccessRule. The SetServiceOperationAccessRule on the other hand sets rules for a specified operation. Let us define an access rule to expose the Products Entity we created earlier. We use the EnititySetRights.AllRead since we want to give read only access. Our modified code is shown below. public class DataService : DataService<NorthwindEntities> { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("Products", EntitySetRights.AllRead); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } We are done setting up our ODataFeed! Compile your project. Right click on DataService.svc and select “View in Browser” to see the OData feed. To view the feed in IE, you must make sure that "Feed Reading View" is turned off. You set this under Tools -› Internet Options -› Content tab.   If you navigate to “Products”, you should see the Products feed. Note also that URIs are case sensitive. ie. Products work but products doesn’t.   Filtering our data OData has a set of system query operations you can use to perform common operations against data exposed by the model. For example, to see only Products in CategoryID 2, we can use the following request: /DataService.svc/Products?$filter=CategoryID eq 2 At the time of this writing, supported operations are $orderby, $top, $skip, $filter, $expand, $format†, $select, $inlinecount. Pre-filtering our data using Query Interceptors The Product feed currently returns all Products. We want to change that so that it contains only Products that have not been discontinued. WCF introduces the concept of interceptors which allows us to inject custom validation/policy logic into the request/response pipeline of a WCF data service. We will use a QueryInterceptor to pre-filter the data so that it returns only Products that are not discontinued. To create a QueryInterceptor, write a method that returns an Expression<Func<T, bool>> and mark it with the QueryInterceptor attribute as shown below. [QueryInterceptor("Products")] public Expression<Func<Product, bool>> OnReadProducts() { return o => o.Discontinued == false; } Viewing the feed after compilation will only show products that have not been discontinued. We also confirm this by looking at the WHERE clause in the SQL generated by the entity framework. SELECT [Extent1].[ProductID] AS [ProductID], ... ... [Extent1].[Discontinued] AS [Discontinued] FROM [dbo].[Products] AS [Extent1] WHERE 0 = [Extent1].[Discontinued] Other examples of Query/Change interceptors can be seen here including an example to filter data based on the identity of the authenticated user. We are done pre-filtering our data. In the next part of this post, we will see how to shape our data. Pre-filtering and shaping OData feeds using WCF Data Services and the Entity Framework - Part 2 Foot Notes * http://msdn.microsoft.com/en-us/data/aa937697.aspx † $format did not work for me. The way to get a Json response is to include the following in the  request header “Accept: application/json, text/javascript, */*” when making the request. This is easily done with most JavaScript libraries.

    Read the article

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