Copying Data

Topics: General
Jul 20, 2011 at 7:31 PM
Edited Jul 20, 2011 at 8:12 PM

Hi,

I want to copy data for blog posts from a file to Composite. I already have the global data type made, and am planning to have code run at startup. I tried looking at the source code to see where I should start, but I got a bit lost.

I understand that you have to use a DataConnection, but what class is the DataType in? Should I use DataFacade, IDataFacade, or something like IDataTypeDescriptor? Any push in the right direction would be nice.

Thanks!

Naibla

Edit: WOW! How did I manage to miss the documentation? http://docs.composite.net/C1/Data/AccessingDataWithCSharp.aspx

Sorry for taking up space...

Jul 20, 2011 at 8:48 PM
Edited Jul 20, 2011 at 8:55 PM

So now I'm having a different problem. Visual Studio is not recognizing any of the global datatypes. The code goes something like this:

 

using (DataConnection conn = new DataConnection())
{
      var newEntry = conn.CreateNew<Composite.Community.Blog.Entries>();
    //set values...
}

 But it won't recognized the Entries type, so it can't build...

I have references to Composite, Composite.Generated, and the Contrib, which were all added after the blog module was.

I have using directives for Composite, Composite.Data, Composite.Data.Types, and Composite.GeneratedTypes...

I'm not sure what I'm missing, but any help would be nice.

 

EDIT: ?????????!!!! It fixed itself, and I didn't do anything... Sorry for wasting even more space...

Coordinator
Jul 20, 2011 at 11:35 PM

The data types you create in the C1 Console are not "visible" to ASP-NET or your Visual Studio intellisense untill your site is restarted (use the Tools | Restart Server command or restart asp.net app). Once your site has restarted, the data type you created have been compiled into ~/bin/Composite.Dynamic.dll and ASP.NET and your VS2010 can see the type just fine. So the "it fixed itself" was probably because your website restarted.

This is a bug and I'm glad to report it is fixed in the next version :)